tar: extract creation mode
mode for newly-created files should be restrictive. chmod is always called soon after to set correct mode from the archive.
This commit is contained in:
parent
11fee4c8ba
commit
85a9254d3a
2
tar.c
2
tar.c
|
@ -270,7 +270,7 @@ unarchive(char *fname, ssize_t l, char b[BLKSIZ])
|
||||||
case RESERVED:
|
case RESERVED:
|
||||||
if ((mode = strtol(h->mode, &p, 8)) < 0 || *p != '\0')
|
if ((mode = strtol(h->mode, &p, 8)) < 0 || *p != '\0')
|
||||||
eprintf("strtol %s: invalid number\n", h->mode);
|
eprintf("strtol %s: invalid number\n", h->mode);
|
||||||
fd = open(fname, O_WRONLY | O_TRUNC | O_CREAT, 0644);
|
fd = open(fname, O_WRONLY | O_TRUNC | O_CREAT, 0600);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
eprintf("open %s:", fname);
|
eprintf("open %s:", fname);
|
||||||
if (fchmod(fd, mode) < 0)
|
if (fchmod(fd, mode) < 0)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user