diff options
author | sobomax <sobomax@FreeBSD.org> | 2002-08-01 17:32:08 +0000 |
---|---|---|
committer | sobomax <sobomax@FreeBSD.org> | 2002-08-01 17:32:08 +0000 |
commit | 779578be8a2bc8958d4f8f38abd645d5e97faf65 (patch) | |
tree | b204fe6dd308420d52d152271d9985e51a92f808 /contrib/tar | |
parent | c429949b89ab52f316f9eb2ae375013c3ea23c66 (diff) | |
download | FreeBSD-src-779578be8a2bc8958d4f8f38abd645d5e97faf65.zip FreeBSD-src-779578be8a2bc8958d4f8f38abd645d5e97faf65.tar.gz |
Move even closer to matching behaviour of our old tar(1) wrt preserving
modes of extracted files. This effectively disables special threating
of uid 0 for mode-preserving purposes and should fix problems with
pkg_add(1) and probably other things when extracting files/dirs with
sticky mode bits set.
Pointed out by: bde
MFC in: 2 weeks
Diffstat (limited to 'contrib/tar')
-rw-r--r-- | contrib/tar/src/extract.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/contrib/tar/src/extract.c b/contrib/tar/src/extract.c index 3dd2fce..e492483 100644 --- a/contrib/tar/src/extract.c +++ b/contrib/tar/src/extract.c @@ -129,6 +129,9 @@ extr_init (void) { umask (newdir_umask); /* restore the kernel umask */ current_umask = newdir_umask; +#ifdef __FreeBSD__ + same_permissions_option++; +#endif } } @@ -184,7 +187,7 @@ set_mode (char const *file_name, struct stat const *stat_info, mode = current_stat_info->st_mode ^ invert_permissions; } - if (chmod (file_name, mode) != 0) + if (chmod (file_name, mode & ~ current_umask) != 0) chmod_error_details (file_name, mode); } |