diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2005-04-11 20:12:32 +0000 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2005-04-11 20:12:32 +0000 |
commit | 39d496f0754bd249a26d989addcabeb39d4b5222 (patch) | |
tree | aae087540b245c50c2d74ffe71cdd724470ce8d3 /src | |
parent | 857b9db0e0fffd8e18c30bd090cac63eaa253214 (diff) | |
download | coreutils-39d496f0754bd249a26d989addcabeb39d4b5222.tar.xz |
Include unistd-safer.h.
(touch): Use fd_safer.
Diffstat (limited to 'src')
-rw-r--r-- | src/touch.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/touch.c b/src/touch.c index 34ce8c433..ad19f4e42 100644 --- a/src/touch.c +++ b/src/touch.c @@ -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 |