aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Kraai <kraai@debian.org>2001-04-30 16:43:21 +0000
committerMatt Kraai <kraai@debian.org>2001-04-30 16:43:21 +0000
commit43ca13714b4dc720a617ce23f89eb860bfb62303 (patch)
tree9124d67f06842c2f95bec49b5566193b3f0b2552
parent24abecc3490cb419ec9bac79af31f8ded1e3fba7 (diff)
downloadbusybox-w32-43ca13714b4dc720a617ce23f89eb860bfb62303.tar.gz
busybox-w32-43ca13714b4dc720a617ce23f89eb860bfb62303.tar.bz2
busybox-w32-43ca13714b4dc720a617ce23f89eb860bfb62303.zip
Simplify permission handling for FIFOs.
-rw-r--r--libbb/copy_file.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/libbb/copy_file.c b/libbb/copy_file.c
index 062ecb901..b2750ccf8 100644
--- a/libbb/copy_file.c
+++ b/libbb/copy_file.c
@@ -184,21 +184,10 @@ int copy_file(const char *source, const char *dest, int flags)
184 return -1; 184 return -1;
185 } 185 }
186 } else if (S_ISFIFO(source_stat.st_mode)) { 186 } else if (S_ISFIFO(source_stat.st_mode)) {
187 mode_t mode, saved_umask; 187 if (mkfifo(dest, source_stat.st_mode) < 0) {
188 saved_umask = umask(0);
189
190 mode = source_stat.st_mode;
191 if (!(flags & FILEUTILS_PRESERVE_STATUS))
192 mode = source_stat.st_mode & ~saved_umask;
193 mode |= S_IRWXU;
194
195 if (mkfifo(dest, mode) < 0) {
196 umask(saved_umask);
197 perror_msg("cannot create fifo `%s'", dest); 188 perror_msg("cannot create fifo `%s'", dest);
198 return -1; 189 return -1;
199 } 190 }
200
201 umask(saved_umask);
202 } else if (S_ISLNK(source_stat.st_mode)) { 191 } else if (S_ISLNK(source_stat.st_mode)) {
203 int size; 192 int size;
204 char buf[BUFSIZ + 1]; 193 char buf[BUFSIZ + 1];