summaryrefslogtreecommitdiff
path: root/src/truncate.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/truncate.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/truncate.c')
-rw-r--r--src/truncate.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/truncate.c b/src/truncate.c
index e37ab3800..c1e966617 100644
--- a/src/truncate.c
+++ b/src/truncate.c
@@ -244,7 +244,6 @@ main (int argc, char **argv)
off_t size IF_LINT ( = 0);
off_t rsize = -1;
rel_mode_t rel_mode = rm_abs;
- mode_t omode;
int c, fd = -1, oflags;
char const *fname;
@@ -385,11 +384,10 @@ main (int argc, char **argv)
}
oflags = O_WRONLY | (no_create ? 0 : O_CREAT) | O_NONBLOCK;
- omode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
while ((fname = *argv++) != NULL)
{
- if ((fd = open (fname, oflags, omode)) == -1)
+ if ((fd = open (fname, oflags, MODE_RW_UGO)) == -1)
{
/* 'truncate -s0 -c no-such-file' shouldn't gen error
'truncate -s0 no-such-dir/file' should gen ENOENT error