FreeBSD Bugzilla – Attachment 13081 Details for
Bug 25017
cp -pRP does not preserve symlink ownership
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 1.12 KB, created by
mkamm
on 2001-02-11 22:50:02 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
mkamm
Created:
2001-02-11 22:50:02 UTC
Size:
1.12 KB
patch
obsolete
>Index: utils.c >=================================================================== >RCS file: /home/ncvs/src/bin/cp/utils.c,v >retrieving revision 1.28 >diff -u -r1.28 utils.c >--- utils.c 2000/10/10 01:48:18 1.28 >+++ utils.c 2001/02/11 00:52:13 >@@ -224,7 +224,7 @@ > warn("symlink: %s", link); > return (1); > } >- return (0); >+ return (pflag ? setlink(p->fts_statp) : 0); > } > > int >@@ -305,7 +305,7 @@ > > if (!gotstat || fs->st_mode != ts.st_mode) > if (fd ? fchmod(fd, fs->st_mode) : chmod(to.p_path, fs->st_mode)) { >- warn("chown: %s", to.p_path); >+ warn("chmod: %s", to.p_path); > rval = 1; > } > >@@ -318,6 +318,31 @@ > > return (rval); > } >+ >+ >+int >+setlink(fs) >+ struct stat *fs; >+{ >+ struct stat ts; >+ >+ if (lstat(to.p_path, &ts)) { >+ warn("symlink %s disappeared", to.p_path); >+ return (1); >+ } >+ /* >+ * Changing the ownership probably won't succeed, unless we are root. >+ */ >+ if (fs->st_uid != ts.st_uid || fs->st_gid != ts.st_gid) >+ if (lchown(to.p_path, fs->st_uid, fs->st_gid)) { >+ if (errno != EPERM) { >+ warn("lchown: %s", to.p_path); >+ return (1); >+ } >+ } >+ return (0); >+} >+ > > void > usage()
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 25017
: 13081