lkml.org 
[lkml]   [2004]   [Apr]   [8]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: dd PATCH: add conv=direct
FromJim Meyering <>
DateThu, 08 Apr 2004 13:07:30 +0200
Paul Eggert <eggert@CS.UCLA.EDU> 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  <jim@meyering.net>

	* 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));

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:02    [from the cache]
©2003-2008