bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dd PATCH: add conv=direct


From: Jim Meyering
Subject: Re: dd PATCH: add conv=direct
Date: Thu, 08 Apr 2004 13:07:30 +0200

Paul Eggert <address@hidden> wrote:
> At the end of this message is a proposed patch to implement everything
> people other than myself have asked for so far, along with several
> other things since I was in the neighborhood.

Thanks for that nice patch!
I've applied it, and made these additional changes:

2004-04-08  Jim Meyering  <address@hidden>

        * src/dd.c (set_fd_flags): Don't OR in -1 when fcntl fails.
        Rename parameter, flags, to avoid shadowing global.

Index: dd.c
===================================================================
RCS file: /fetish/cu/src/dd.c,v
retrieving revision 1.155
diff -u -p -r1.155 dd.c
--- a/dd.c      8 Apr 2004 10:22:05 -0000       1.155
+++ b/dd.c      8 Apr 2004 11:02:20 -0000
@@ -1017,12 +1017,12 @@ copy_with_unblock (char const *buf, size
    in FLAGS.  The file's name is NAME.  */
 
 static void
-set_fd_flags (int fd, int flags, char const *name)
+set_fd_flags (int fd, int add_flags, char const *name)
 {
-  if (flags)
+  if (add_flags)
     {
       int old_flags = fcntl (fd, F_GETFL);
-      int new_flags = old_flags | flags;
+      int new_flags = old_flags < 0 ? add_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));






reply via email to

[Prev in Thread] Current Thread [Next in Thread]