Skip to content

Commit

Permalink
truncate: use O_WRONLY|O_NONBLOCK
Browse files Browse the repository at this point in the history
This matches coreutils behavior.  We don't read the fd, and truncation
does not need blocking.

Signed-off-by: Mike Frysinger <[email protected]>
  • Loading branch information
vapier committed Jan 13, 2016
1 parent e111a16 commit 6a70db8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion coreutils/truncate.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ int truncate_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int truncate_main(int argc UNUSED_PARAM, char **argv)
{
unsigned opts;
int flags = O_RDWR;
int flags = O_WRONLY | O_NONBLOCK;
int ret = EXIT_SUCCESS;
char *size_str;
off_t size;
Expand Down

0 comments on commit 6a70db8

Please sign in to comment.