summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sbin/restore/dirs.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sbin/restore/dirs.c b/sbin/restore/dirs.c
index 53743a8..c61737a 100644
--- a/sbin/restore/dirs.c
+++ b/sbin/restore/dirs.c
@@ -146,9 +146,12 @@ extractdirs(genmode)
struct inotab *itp;
struct direct nulldir;
int fd;
+ const char *tmpdir;
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') {
(void *) strcat(dirfile, "-XXXXXX");
fd = mkstemp(dirfile);
@@ -161,7 +164,7 @@ extractdirs(genmode)
done(1);
}
if (genmode != 0) {
- (void) sprintf(modefile, "%srstmode%d", _PATH_TMP, dumpdate);
+ (void) sprintf(modefile, "%s/rstmode%d", tmpdir, dumpdate);
if (command != 'r' && command != 'R') {
(void *) strcat(modefile, "-XXXXXX");
fd = mkstemp(modefile);
@@ -593,10 +596,13 @@ setdirmodes(flags)
struct modeinfo node;
struct entry *ep;
char *cp;
+ const char *tmpdir;
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')
- (void) sprintf(modefile, "%srstmode%d", _PATH_TMP, dumpdate);
+ (void) sprintf(modefile, "%s/rstmode%d", tmpdir, dumpdate);
if (modefile[0] == '#') {
panic("modefile not defined\n");
fprintf(stderr, "directory mode, owner, and times not set\n");
OpenPOWER on IntegriCloud