summaryrefslogtreecommitdiff
path: root/src/dd.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2004-04-08 21:30:18 +0000
committerJim Meyering <jim@meyering.net>2004-04-08 21:30:18 +0000
commit82024e99380fd825701a5e11c563ea3c8abda516 (patch)
tree85a49d961f13d17b505c58b41c42489426421446 /src/dd.c
parent1af4fd3a542a684968d17381eb2cbd529f5ab227 (diff)
downloadcoreutils-82024e99380fd825701a5e11c563ea3c8abda516.tar.xz
(set_fd_flags): Undo part of today's change: it's a little
cleaner -- and more efficient in the common case -- to go ahead and OR in the -1 when fcntl fails.
Diffstat (limited to 'src/dd.c')
-rw-r--r--src/dd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/dd.c b/src/dd.c
index 8b3b67f89..0b486e634 100644
--- a/src/dd.c
+++ b/src/dd.c
@@ -1014,7 +1014,7 @@ copy_with_unblock (char const *buf, size_t nread)
}
/* Set the file descriptor flags for FD that correspond to the nonzero bits
- in FLAGS. The file's name is NAME. */
+ in ADD_FLAGS. The file's name is NAME. */
static void
set_fd_flags (int fd, int add_flags, char const *name)
@@ -1022,7 +1022,7 @@ set_fd_flags (int fd, int add_flags, char const *name)
if (add_flags)
{
int old_flags = fcntl (fd, F_GETFL);
- int new_flags = old_flags < 0 ? add_flags : (old_flags | add_flags);
+ int new_flags = old_flags | add_flags;
if (old_flags < 0
|| (new_flags != old_flags && fcntl (fd, F_SETFL, new_flags) == -1))
error (EXIT_FAILURE, errno, _("setting flags for %s"), quote (name));