[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
fix minor incompatibility of GNU cp with Solaris cp on Solaris
From: |
Paul Eggert |
Subject: |
fix minor incompatibility of GNU cp with Solaris cp on Solaris |
Date: |
Wed, 18 Oct 2006 15:52:11 -0700 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux) |
On Solaris, GNU cp doesn't preserve the special mode bits of a fifo
when copying, but Solaris cp does. With umask 2, I get:
$ ls -l d
total 0
prwSrwSr-- 1 eggert faculty 0 2006-10-18 14:06 fifo
prw-rw-rw- 1 eggert faculty 0 2006-10-18 14:14 fifo1
$ /bin/cp -R d d1
$ gnucp -R d d2
$ ls -l d1 d2
d1:
total 0
prwSrwSr-- 1 eggert faculty 0 2006-10-18 15:34 fifo
prw-rw-r-- 1 eggert faculty 0 2006-10-18 15:34 fifo1
d2:
total 0
prw-rw-r-- 1 eggert faculty 0 2006-10-18 15:34 fifo
prw-rw-r-- 1 eggert faculty 0 2006-10-18 15:34 fifo1
I installed the following patch to change GNU cp to match Solaris cp
here; I think that's more consistent, as this is how GNU cp behaves
with block and character special files already.
There is no change on GNU/Linux hosts, as they already behave the same
way that Solaris 10 cp behaves.
2006-10-18 Paul Eggert <address@hidden>
* src/copy.c (copy_internal): Use mknod rather than mkfifo to copy
a fifo. This preserves the special mode bits on Solaris 10, which
is compatible with what Solaris 10 cp -R does.
--- src/copy.c 18 Oct 2006 21:02:27 -0000 1.216
+++ src/copy.c 18 Oct 2006 22:04:02 -0000
@@ -1638,7 +1638,7 @@ copy_internal (char const *src_name, cha
}
else if (S_ISFIFO (src_mode))
{
- if (mkfifo (dst_name, src_mode))
+ if (mknod (dst_name, src_mode, 0) != 0)
{
error (0, errno, _("cannot create fifo %s"), quote (dst_name));
goto un_backup;
@@ -1646,7 +1646,7 @@ copy_internal (char const *src_name, cha
}
else if (S_ISBLK (src_mode) || S_ISCHR (src_mode) || S_ISSOCK (src_mode))
{
- if (mknod (dst_name, src_mode, src_sb.st_rdev))
+ if (mknod (dst_name, src_mode, src_sb.st_rdev) != 0)
{
error (0, errno, _("cannot create special file %s"),
quote (dst_name));
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- fix minor incompatibility of GNU cp with Solaris cp on Solaris,
Paul Eggert <=