Honour `TMPDIR' environment variable.
Reviewed by: ru Approved by: ru MFC after: 2 weeks
This commit is contained in:
parent
0ce18d0354
commit
4afde8553d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=81579
@ -146,9 +146,12 @@ extractdirs(genmode)
|
|||||||
struct inotab *itp;
|
struct inotab *itp;
|
||||||
struct direct nulldir;
|
struct direct nulldir;
|
||||||
int fd;
|
int fd;
|
||||||
|
const char *tmpdir;
|
||||||
|
|
||||||
vprintf(stdout, "Extract directories from tape\n");
|
vprintf(stdout, "Extract directories from tape\n");
|
||||||
(void) sprintf(dirfile, "%srstdir%d", _PATH_TMP, dumpdate);
|
if ((tmpdir = getenv("TMPDIR")) == NULL || tmpdir[0] == '\0')
|
||||||
|
tmpdir = _PATH_TMP;
|
||||||
|
(void) sprintf(dirfile, "%s/rstdir%d", tmpdir, dumpdate);
|
||||||
if (command != 'r' && command != 'R') {
|
if (command != 'r' && command != 'R') {
|
||||||
(void *) strcat(dirfile, "-XXXXXX");
|
(void *) strcat(dirfile, "-XXXXXX");
|
||||||
fd = mkstemp(dirfile);
|
fd = mkstemp(dirfile);
|
||||||
@ -161,7 +164,7 @@ extractdirs(genmode)
|
|||||||
done(1);
|
done(1);
|
||||||
}
|
}
|
||||||
if (genmode != 0) {
|
if (genmode != 0) {
|
||||||
(void) sprintf(modefile, "%srstmode%d", _PATH_TMP, dumpdate);
|
(void) sprintf(modefile, "%s/rstmode%d", tmpdir, dumpdate);
|
||||||
if (command != 'r' && command != 'R') {
|
if (command != 'r' && command != 'R') {
|
||||||
(void *) strcat(modefile, "-XXXXXX");
|
(void *) strcat(modefile, "-XXXXXX");
|
||||||
fd = mkstemp(modefile);
|
fd = mkstemp(modefile);
|
||||||
@ -593,10 +596,13 @@ setdirmodes(flags)
|
|||||||
struct modeinfo node;
|
struct modeinfo node;
|
||||||
struct entry *ep;
|
struct entry *ep;
|
||||||
char *cp;
|
char *cp;
|
||||||
|
const char *tmpdir;
|
||||||
|
|
||||||
vprintf(stdout, "Set directory mode, owner, and times.\n");
|
vprintf(stdout, "Set directory mode, owner, and times.\n");
|
||||||
|
if ((tmpdir = getenv("TMPDIR")) == NULL || tmpdir[0] == '\0')
|
||||||
|
tmpdir = _PATH_TMP;
|
||||||
if (command == 'r' || command == 'R')
|
if (command == 'r' || command == 'R')
|
||||||
(void) sprintf(modefile, "%srstmode%d", _PATH_TMP, dumpdate);
|
(void) sprintf(modefile, "%s/rstmode%d", tmpdir, dumpdate);
|
||||||
if (modefile[0] == '#') {
|
if (modefile[0] == '#') {
|
||||||
panic("modefile not defined\n");
|
panic("modefile not defined\n");
|
||||||
fprintf(stderr, "directory mode, owner, and times not set\n");
|
fprintf(stderr, "directory mode, owner, and times not set\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user