]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Include unistd-safer.h.
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 11 Apr 2005 20:12:32 +0000 (20:12 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 11 Apr 2005 20:12:32 +0000 (20:12 +0000)
(touch): Use fd_safer.

src/touch.c

index 34ce8c4335e9e508bd9f6af6fc73139d05dc19de..ad19f4e420257b5131e4565b93569dec827b9bd9 100644 (file)
@@ -31,6 +31,7 @@
 #include "posixver.h"
 #include "quote.h"
 #include "safe-read.h"
+#include "unistd-safer.h"
 #include "utimens.h"
 
 /* The official name of this program (e.g., no `g' prefix).  */
@@ -128,6 +129,7 @@ touch (const char *file)
       /* Try to open FILE, creating it if necessary.  */
       fd = open (file, O_WRONLY | O_CREAT | O_NONBLOCK | O_NOCTTY,
                 S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
+      fd = fd_safer (fd);
 
       /* Don't save a copy of errno if it's EISDIR, since that would lead
         touch to give a bogus diagnostic for e.g., `touch /' (assuming