summaryrefslogtreecommitdiff
path: root/src/shred.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2005-12-27 08:00:12 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2005-12-27 08:00:12 +0000
commit3f11d67a569b4cf14a9c4bf3e5b1bb80799be00f (patch)
tree12a0d1662166bbb0c37881617c0c04207b2f3111 /src/shred.c
parent40ea51a322910c7695bc4837fc7b11568700c590 (diff)
downloadcoreutils-3f11d67a569b4cf14a9c4bf3e5b1bb80799be00f.tar.xz
(wipename): Use similar open flags to other places we open directories.
Don't bother trying to open dir for writing, since POSIX prohibits it.
Diffstat (limited to 'src/shred.c')
-rw-r--r--src/shred.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/shred.c b/src/shred.c
index 3e47aad1c..fdcc54d7d 100644
--- a/src/shred.c
+++ b/src/shred.c
@@ -1031,9 +1031,7 @@ wipename (char *oldname, char const *qoldname, struct Options const *flags)
bool first = true;
bool ok = true;
- int dir_fd = open (dir, O_WRONLY | O_NOCTTY);
- if (dir_fd < 0)
- dir_fd = open (dir, O_RDONLY | O_NOCTTY);
+ int dir_fd = open (dir, O_RDONLY | O_DIRECTORY | O_NOCTTY | O_NONBLOCK);
if (flags->verbose)
error (0, 0, _("%s: removing"), qoldname);