Simplify permission handling for FIFOs.

This commit is contained in:
Matt Kraai 2001-04-30 16:43:21 +00:00
parent 24abecc349
commit 43ca13714b

View File

@ -184,21 +184,10 @@ int copy_file(const char *source, const char *dest, int flags)
return -1; return -1;
} }
} else if (S_ISFIFO(source_stat.st_mode)) { } else if (S_ISFIFO(source_stat.st_mode)) {
mode_t mode, saved_umask; if (mkfifo(dest, source_stat.st_mode) < 0) {
saved_umask = umask(0);
mode = source_stat.st_mode;
if (!(flags & FILEUTILS_PRESERVE_STATUS))
mode = source_stat.st_mode & ~saved_umask;
mode |= S_IRWXU;
if (mkfifo(dest, mode) < 0) {
umask(saved_umask);
perror_msg("cannot create fifo `%s'", dest); perror_msg("cannot create fifo `%s'", dest);
return -1; return -1;
} }
umask(saved_umask);
} else if (S_ISLNK(source_stat.st_mode)) { } else if (S_ISLNK(source_stat.st_mode)) {
int size; int size;
char buf[BUFSIZ + 1]; char buf[BUFSIZ + 1];