--- dump/dump.h.orig Sun Dec 15 22:14:30 1996 +++ dump/dump.h Wed Dec 25 16:11:06 1996 @@ -40,6 +40,9 @@ * @(#)dump.h 8.2 (Berkeley) 4/28/95 */ +/* /etc/dumpdates will not be created, when not already here (Bug#3806). + David Frey */ + #define MAXINOPB (MAXBSIZE / sizeof(struct dinode)) #define MAXNINDIR (MAXBSIZE / sizeof(daddr_t)) @@ -195,8 +198,8 @@ int nddates; /* number of records (might be zero) */ int ddates_in; /* we have read the increment file */ struct dumpdates **ddatev; /* the arrayfied version */ -void initdumptimes __P((void)); -void getdumptime __P((void)); +void initdumptimes __P((int)); +void getdumptime __P((int)); void putdumptime __P((void)); #define ITITERATE(i, ddp) \ for (ddp = ddatev[i = 0]; i < nddates; ddp = ddatev[++i]) --- dump/itime.c.orig Sun Dec 15 22:14:30 1996 +++ dump/itime.c Wed Dec 25 16:18:15 1996 @@ -4,6 +4,8 @@ * Remy Card , 1994, 1995, 1996 * */ +/* /etc/dumpdates will not be created, when not already here (Bug#3806). + David Frey */ /*- * Copyright (c) 1980, 1993 @@ -88,7 +90,8 @@ static void readdumptimes __P((FILE *)); void -initdumptimes() +initdumptimes(createdumpdates) +int createdumpdates; { FILE *df; @@ -101,22 +104,26 @@ /* * Dumpdates does not exist, make an empty one. */ - msg("WARNING: no file `%s', making an empty one\n", dumpdates); - if ((df = fopen(dumpdates, "w")) == NULL) { - quit("cannot create %s: %s\n", dumpdates, - strerror(errno)); - /* NOTREACHED */ + if (createdumpdates) { + msg("WARNING: no file `%s', making an empty one\n", dumpdates); + if ((df = fopen(dumpdates, "w")) == NULL) { + quit("cannot create %s: %s\n", dumpdates, + strerror(errno)); + /* NOTREACHED */ + } + (void) fclose(df); + if ((df = fopen(dumpdates, "r")) == NULL) { + quit("cannot read %s even after creating it: %s\n", + dumpdates, strerror(errno)); + /* NOTREACHED */ + } } + } + if (df != NULL) { + (void) flock(fileno(df), LOCK_SH); + readdumptimes(df); (void) fclose(df); - if ((df = fopen(dumpdates, "r")) == NULL) { - quit("cannot read %s even after creating it: %s\n", - dumpdates, strerror(errno)); - /* NOTREACHED */ - } } - (void) flock(fileno(df), LOCK_SH); - readdumptimes(df); - (void) fclose(df); } static void @@ -148,7 +155,8 @@ } void -getdumptime() +getdumptime(createdumpdates) +int createdumpdates; { register struct dumpdates *ddp; register int i; @@ -162,7 +170,9 @@ spcl.c_ddate = 0; lastlevel = '0'; - initdumptimes(); + initdumptimes(createdumpdates); + if (ddp == NULL) + return; /* * Go find the entry with the same name for a lower increment * and older date --- dump/main.c.orig Sun Dec 15 22:14:30 1996 +++ dump/main.c Wed Dec 25 16:09:26 1996 @@ -4,6 +4,8 @@ * Remy Card , 1994, 1995, 1996 * */ +/* /etc/dumpdates will not be created, when not already here (Bug#3806). + David Frey */ /*- * Copyright (c) 1980, 1991, 1993, 1994 @@ -331,7 +333,7 @@ spcl.c_level = level - '0'; spcl.c_type = TS_TAPE; if (!Tflag) - getdumptime(); /* /etc/dumpdates snarfed */ + getdumptime(uflag); /* /etc/dumpdates snarfed */ msg("Date of this level %c dump: %s", level, #ifdef __linux --- dump/optr.c.orig Sun Dec 15 22:14:30 1996 +++ dump/optr.c Wed Dec 25 16:09:26 1996 @@ -4,6 +4,8 @@ * Remy Card , 1994, 1995, 1996 * */ +/* /etc/dumpdates will not be created, when not already here (Bug#3806). + David Frey */ /*- * Copyright (c) 1980, 1988, 1993 @@ -534,22 +536,24 @@ { register int i; register struct fstab *dt; - register struct dumpdates *dtwalk; + register struct dumpdates *dtwalk=NULL; char *lastname, *date; int dumpme; time_t tnow; (void) time(&tnow); getfstab(); /* /etc/fstab input */ - initdumptimes(); /* /etc/dumpdates input */ - qsort((char *) ddatev, nddates, sizeof(struct dumpdates *), datesort); - - if (arg == 'w') - (void) printf("Dump these file systems:\n"); - else + initdumptimes(0); /* /etc/dumpdates input */ + if (*ddatev != NULL) + { + qsort((char *) ddatev, nddates, sizeof(struct dumpdates *), datesort); + + if (arg == 'w') + (void) printf("Dump these file systems:\n"); + else (void) printf("Last dump(s) done (Dump '>' file systems):\n"); - lastname = "??"; - ITITERATE(i, dtwalk) { + lastname = "??"; + ITITERATE(i, dtwalk) { if (strncmp(lastname, dtwalk->dd_name, sizeof(dtwalk->dd_name)) == 0) continue; @@ -568,6 +572,7 @@ dt ? dt->fs_file : "", dtwalk->dd_level, date); + } } }