summaryrefslogtreecommitdiff
path: root/src/touch.c
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2012-06-22 11:17:38 +0100
committerPádraig Brady <P@draigBrady.com>2012-06-22 11:17:38 +0100
commit30a604e631291b80b9812e03e0f325489ae0d77e (patch)
treedd6c760b0e161c416e1f95ab9c78c76a11981dc9 /src/touch.c
parent4cfca3916d878afdd0d0b111354f30decc41e8f5 (diff)
downloadcoreutils-30a604e631291b80b9812e03e0f325489ae0d77e.tar.xz
maint: refactor common mode bits used to create files
* src/system.h (MODE_RW_UGO): The new refactored define (666). * src/mkfifo.c: Use the new define. * src/mknod.c: Likewise. * src/split.c: Likewise. * src/system.h: Likewise. * src/touch.c: Likewise. * src/truncate.c: Likewise. Suggested-by: Jim Meyering
Diffstat (limited to 'src/touch.c')
-rw-r--r--src/touch.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/touch.c b/src/touch.c
index 368516e7d..5976a34c9 100644
--- a/src/touch.c
+++ b/src/touch.c
@@ -131,11 +131,8 @@ touch (const char *file)
else if (! (no_create || no_dereference))
{
/* Try to open FILE, creating it if necessary. */
- int default_permissions =
- S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
fd = fd_reopen (STDIN_FILENO, file,
- O_WRONLY | O_CREAT | O_NONBLOCK | O_NOCTTY,
- default_permissions);
+ O_WRONLY | O_CREAT | O_NONBLOCK | O_NOCTTY, MODE_RW_UGO);
/* 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