diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/copy.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/copy.c b/src/copy.c index bdb8a1f2f..d9ad254a9 100644 --- a/src/copy.c +++ b/src/copy.c @@ -1686,12 +1686,16 @@ copy_internal (char const *src_name, char const *dst_name, { /* Use mknod, rather than mkfifo, because the former preserves the special mode bits of a fifo on Solaris 10, while mkfifo - does not. */ + does not. But fall back on mkfifo, because on some BSD systems, + mknod always fails when asked to create a FIFO. */ if (mknod (dst_name, src_mode & ~omitted_permissions, 0) != 0) - { - error (0, errno, _("cannot create fifo %s"), quote (dst_name)); - goto un_backup; - } +#if HAVE_MKFIFO + if (mkfifo (dst_name, src_mode & ~S_IFIFO & ~omitted_permissions) != 0) +#endif + { + error (0, errno, _("cannot create fifo %s"), quote (dst_name)); + goto un_backup; + } } else if (S_ISBLK (src_mode) || S_ISCHR (src_mode) || S_ISSOCK (src_mode)) { |