PAX leaves archives world writeable
Rob McMahon
cudcv at warwick.ac.uk
Wed Feb 22 01:11:09 AEST 1989
Pax creating an archive with a -f flag leaves the archive mode 666. It calls
umask(0) early on, storing the old umask in `mask', but doesn't use this when
creating the archive. I believe this patch fixes the problem, and also a
similar one on systems not having the mkdir system call.
Rob
RCS file: fileio.c,v
retrieving revision 1.1
diff -c -r1.1 fileio.c
*** /tmp/,RCSt1a01285 Tue Feb 21 15:04:47 1989
--- fileio.c Tue Feb 21 14:37:09 1989
***************
*** 93,101 ****
archivefd = open(ar_file, O_RDONLY | O_BINARY);
bufend = bufidx = bufstart; /* set up for initial read */
} else if (mode == AR_WRITE) {
! archivefd = open(ar_file, O_WRONLY|O_TRUNC|O_CREAT|O_BINARY, 0666);
} else if (mode == AR_APPEND) {
! archivefd = open(ar_file, O_RDWR | O_BINARY, 0666);
bufend = bufidx = bufstart; /* set up for initial read */
}
--- 93,102 ----
archivefd = open(ar_file, O_RDONLY | O_BINARY);
bufend = bufidx = bufstart; /* set up for initial read */
} else if (mode == AR_WRITE) {
! archivefd = open(ar_file, O_WRONLY|O_TRUNC|O_CREAT|O_BINARY,
! 0666 & ~mask);
} else if (mode == AR_APPEND) {
! archivefd = open(ar_file, O_RDWR | O_BINARY, 0666 & ~mask);
bufend = bufidx = bufstart; /* set up for initial read */
}
RCS file: port.c,v
retrieving revision 1.1
diff -c -r1.1 port.c
*** /tmp/,RCSt1a01291 Tue Feb 21 15:06:27 1989
--- port.c Mon Feb 20 23:07:31 1989
***************
*** 114,121 ****
case 0: /* Child process */
! status = umask(0); /* Get current umask */
! status = umask(status | (0777 & ~dmode)); /* Set for mkdir */
execl("/bin/mkdir", "mkdir", dpath, (char *) 0);
_exit(-1); /* Can't exec /bin/mkdir */
--- 114,120 ----
case 0: /* Child process */
! (void) umask(mask | (0777 & ~dmode)); /* Set for mkdir */
execl("/bin/mkdir", "mkdir", dpath, (char *) 0);
_exit(-1); /* Can't exec /bin/mkdir */
--
UUCP: ...!mcvax!ukc!warwick!cudcv PHONE: +44 203 523037
JANET: cudcv at uk.ac.warwick ARPA: cudcv at warwick.ac.uk
Rob McMahon, Computing Services, Warwick University, Coventry CV4 7AL, England
More information about the Comp.sources.bugs
mailing list