FreeBSD Bugzilla – Attachment 30186 Details for
Bug 50949
mtree(8) doesn't honor the -P when checking/changing ownership
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 4.63 KB, created by
Rene de Vries
on 2003-04-14 16:50:01 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Rene de Vries
Created:
2003-04-14 16:50:01 UTC
Size:
4.63 KB
patch
obsolete
>Index: usr.sbin/mtree/compare.c >=================================================================== >RCS file: /home/fbsd-cvsrepo/src/usr.sbin/mtree/compare.c,v >retrieving revision 1.25 >diff -u -r1.25 compare.c >--- usr.sbin/mtree/compare.c 13 Mar 2003 23:35:30 -0000 1.25 >+++ usr.sbin/mtree/compare.c 1 Apr 2003 14:34:12 -0000 >@@ -63,6 +63,7 @@ > > extern int uflag; > extern int lineno; >+extern int ftsoptions; > > static const char *ftype(u_int); > >@@ -127,11 +128,19 @@ > (void)printf("%suser expected %lu found %lu", > tab, (u_long)s->st_uid, (u_long)p->fts_statp->st_uid); > if (uflag) >- if (chown(p->fts_accpath, s->st_uid, -1)) >- (void)printf(" not modified: %s\n", >- strerror(errno)); >- else >- (void)printf(" modified\n"); >+ if (ftsoptions & FTS_PHYSICAL) { >+ if (lchown(p->fts_accpath, s->st_uid, -1)) >+ (void)printf(" not modified: %s\n", >+ strerror(errno)); >+ else >+ (void)printf(" modified\n"); >+ } else { >+ if (chown(p->fts_accpath, s->st_uid, -1)) >+ (void)printf(" not modified: %s\n", >+ strerror(errno)); >+ else >+ (void)printf(" modified\n"); >+ } > else > (void)printf("\n"); > tab = "\t"; >@@ -141,11 +150,19 @@ > (void)printf("%sgid expected %lu found %lu", > tab, (u_long)s->st_gid, (u_long)p->fts_statp->st_gid); > if (uflag) >- if (chown(p->fts_accpath, -1, s->st_gid)) >- (void)printf(" not modified: %s\n", >- strerror(errno)); >- else >- (void)printf(" modified\n"); >+ if (ftsoptions & FTS_PHYSICAL) { >+ if (lchown(p->fts_accpath, -1, s->st_gid)) >+ (void)printf(" not modified: %s\n", >+ strerror(errno)); >+ else >+ (void)printf(" modified\n"); >+ } else { >+ if (chown(p->fts_accpath, -1, s->st_gid)) >+ (void)printf(" not modified: %s\n", >+ strerror(errno)); >+ else >+ (void)printf(" modified\n"); >+ } > else > (void)printf("\n"); > tab = "\t"; >@@ -157,11 +174,19 @@ > (void)printf("%spermissions expected %#o found %#o", > tab, s->st_mode, p->fts_statp->st_mode & MBITS); > if (uflag) >- if (chmod(p->fts_accpath, s->st_mode)) >- (void)printf(" not modified: %s\n", >- strerror(errno)); >- else >- (void)printf(" modified\n"); >+ if (ftsoptions & FTS_PHYSICAL) { >+ if (lchmod(p->fts_accpath, s->st_mode)) >+ (void)printf(" not modified: %s\n", >+ strerror(errno)); >+ else >+ (void)printf(" modified\n"); >+ } else { >+ if (chmod(p->fts_accpath, s->st_mode)) >+ (void)printf(" not modified: %s\n", >+ strerror(errno)); >+ else >+ (void)printf(" modified\n"); >+ } > else > (void)printf("\n"); > tab = "\t"; >Index: usr.sbin/mtree/verify.c >=================================================================== >RCS file: /home/fbsd-cvsrepo/src/usr.sbin/mtree/verify.c,v >retrieving revision 1.18 >diff -u -r1.18 verify.c >--- usr.sbin/mtree/verify.c 13 Mar 2003 23:35:30 -0000 1.18 >+++ usr.sbin/mtree/verify.c 1 Apr 2003 14:34:12 -0000 >@@ -226,19 +226,36 @@ > > if (!create) > continue; >- if (chown(path, p->st_uid, p->st_gid)) { >- (void)printf("%s: user/group/mode not modified: %s\n", >- path, strerror(errno)); >- (void)printf("%s: warning: file mode %snot set\n", path, >- (p->flags & F_FLAGS) ? "and file flags " : ""); >- continue; >+ if (ftsoptions & FTS_PHYSICAL) { >+ if (lchown(path, p->st_uid, p->st_gid)) { >+ (void)printf("%s: user/group/mode not modified: %s\n", >+ path, strerror(errno)); >+ (void)printf("%s: warning: file mode %snot set\n", path, >+ (p->flags & F_FLAGS) ? "and file flags " : ""); >+ continue; >+ } >+ if (lchmod(path, p->st_mode)) >+ (void)printf("%s: permissions not set: %s\n", >+ path, strerror(errno)); >+ if ((p->flags & F_FLAGS) && p->st_flags && >+ chflags(path, p->st_flags)) >+ (void)printf("%s: file flags not set: %s\n", >+ path, strerror(errno)); >+ } else { >+ if (chown(path, p->st_uid, p->st_gid)) { >+ (void)printf("%s: user/group/mode not modified: %s\n", >+ path, strerror(errno)); >+ (void)printf("%s: warning: file mode %snot set\n", path, >+ (p->flags & F_FLAGS) ? "and file flags " : ""); >+ continue; >+ } >+ if (chmod(path, p->st_mode)) >+ (void)printf("%s: permissions not set: %s\n", >+ path, strerror(errno)); >+ if ((p->flags & F_FLAGS) && p->st_flags && >+ chflags(path, p->st_flags)) >+ (void)printf("%s: file flags not set: %s\n", >+ path, strerror(errno)); > } >- if (chmod(path, p->st_mode)) >- (void)printf("%s: permissions not set: %s\n", >- path, strerror(errno)); >- if ((p->flags & F_FLAGS) && p->st_flags && >- chflags(path, p->st_flags)) >- (void)printf("%s: file flags not set: %s\n", >- path, strerror(errno)); > } > }
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 50949
: 30186