]>
Commit | Line | Data |
---|---|---|
1227625a SP |
1 | --- dump/dump.h.orig Sun Dec 15 22:14:30 1996 |
2 | +++ dump/dump.h Wed Dec 25 16:11:06 1996 | |
3 | @@ -40,6 +40,9 @@ | |
4 | * @(#)dump.h 8.2 (Berkeley) 4/28/95 | |
5 | */ | |
6 | ||
7 | +/* /etc/dumpdates will not be created, when not already here (Bug#3806). | |
8 | + David Frey */ | |
9 | + | |
10 | #define MAXINOPB (MAXBSIZE / sizeof(struct dinode)) | |
11 | #define MAXNINDIR (MAXBSIZE / sizeof(daddr_t)) | |
12 | ||
13 | @@ -195,8 +198,8 @@ | |
14 | int nddates; /* number of records (might be zero) */ | |
15 | int ddates_in; /* we have read the increment file */ | |
16 | struct dumpdates **ddatev; /* the arrayfied version */ | |
17 | -void initdumptimes __P((void)); | |
18 | -void getdumptime __P((void)); | |
19 | +void initdumptimes __P((int)); | |
20 | +void getdumptime __P((int)); | |
21 | void putdumptime __P((void)); | |
22 | #define ITITERATE(i, ddp) \ | |
23 | for (ddp = ddatev[i = 0]; i < nddates; ddp = ddatev[++i]) | |
24 | --- dump/itime.c.orig Sun Dec 15 22:14:30 1996 | |
25 | +++ dump/itime.c Wed Dec 25 16:18:15 1996 | |
26 | @@ -4,6 +4,8 @@ | |
27 | * Remy Card <card@Linux.EU.Org>, 1994, 1995, 1996 | |
28 | * | |
29 | */ | |
30 | +/* /etc/dumpdates will not be created, when not already here (Bug#3806). | |
31 | + David Frey */ | |
32 | ||
33 | /*- | |
34 | * Copyright (c) 1980, 1993 | |
35 | @@ -88,7 +90,8 @@ | |
36 | static void readdumptimes __P((FILE *)); | |
37 | ||
38 | void | |
39 | -initdumptimes() | |
40 | +initdumptimes(createdumpdates) | |
41 | +int createdumpdates; | |
42 | { | |
43 | FILE *df; | |
44 | ||
45 | @@ -101,22 +104,26 @@ | |
46 | /* | |
47 | * Dumpdates does not exist, make an empty one. | |
48 | */ | |
49 | - msg("WARNING: no file `%s', making an empty one\n", dumpdates); | |
50 | - if ((df = fopen(dumpdates, "w")) == NULL) { | |
51 | - quit("cannot create %s: %s\n", dumpdates, | |
52 | - strerror(errno)); | |
53 | - /* NOTREACHED */ | |
54 | + if (createdumpdates) { | |
55 | + msg("WARNING: no file `%s', making an empty one\n", dumpdates); | |
56 | + if ((df = fopen(dumpdates, "w")) == NULL) { | |
57 | + quit("cannot create %s: %s\n", dumpdates, | |
58 | + strerror(errno)); | |
59 | + /* NOTREACHED */ | |
60 | + } | |
61 | + (void) fclose(df); | |
62 | + if ((df = fopen(dumpdates, "r")) == NULL) { | |
63 | + quit("cannot read %s even after creating it: %s\n", | |
64 | + dumpdates, strerror(errno)); | |
65 | + /* NOTREACHED */ | |
66 | + } | |
67 | } | |
68 | + } | |
69 | + if (df != NULL) { | |
70 | + (void) flock(fileno(df), LOCK_SH); | |
71 | + readdumptimes(df); | |
72 | (void) fclose(df); | |
73 | - if ((df = fopen(dumpdates, "r")) == NULL) { | |
74 | - quit("cannot read %s even after creating it: %s\n", | |
75 | - dumpdates, strerror(errno)); | |
76 | - /* NOTREACHED */ | |
77 | - } | |
78 | } | |
79 | - (void) flock(fileno(df), LOCK_SH); | |
80 | - readdumptimes(df); | |
81 | - (void) fclose(df); | |
82 | } | |
83 | ||
84 | static void | |
85 | @@ -148,7 +155,8 @@ | |
86 | } | |
87 | ||
88 | void | |
89 | -getdumptime() | |
90 | +getdumptime(createdumpdates) | |
91 | +int createdumpdates; | |
92 | { | |
93 | register struct dumpdates *ddp; | |
94 | register int i; | |
95 | @@ -162,7 +170,9 @@ | |
96 | spcl.c_ddate = 0; | |
97 | lastlevel = '0'; | |
98 | ||
99 | - initdumptimes(); | |
100 | + initdumptimes(createdumpdates); | |
101 | + if (ddp == NULL) | |
102 | + return; | |
103 | /* | |
104 | * Go find the entry with the same name for a lower increment | |
105 | * and older date | |
106 | --- dump/main.c.orig Sun Dec 15 22:14:30 1996 | |
107 | +++ dump/main.c Wed Dec 25 16:09:26 1996 | |
108 | @@ -4,6 +4,8 @@ | |
109 | * Remy Card <card@Linux.EU.Org>, 1994, 1995, 1996 | |
110 | * | |
111 | */ | |
112 | +/* /etc/dumpdates will not be created, when not already here (Bug#3806). | |
113 | + David Frey */ | |
114 | ||
115 | /*- | |
116 | * Copyright (c) 1980, 1991, 1993, 1994 | |
117 | @@ -331,7 +333,7 @@ | |
118 | spcl.c_level = level - '0'; | |
119 | spcl.c_type = TS_TAPE; | |
120 | if (!Tflag) | |
121 | - getdumptime(); /* /etc/dumpdates snarfed */ | |
122 | + getdumptime(uflag); /* /etc/dumpdates snarfed */ | |
123 | ||
124 | msg("Date of this level %c dump: %s", level, | |
125 | #ifdef __linux | |
126 | --- dump/optr.c.orig Sun Dec 15 22:14:30 1996 | |
127 | +++ dump/optr.c Wed Dec 25 16:09:26 1996 | |
128 | @@ -4,6 +4,8 @@ | |
129 | * Remy Card <card@Linux.EU.Org>, 1994, 1995, 1996 | |
130 | * | |
131 | */ | |
132 | +/* /etc/dumpdates will not be created, when not already here (Bug#3806). | |
133 | + David Frey */ | |
134 | ||
135 | /*- | |
136 | * Copyright (c) 1980, 1988, 1993 | |
137 | @@ -534,22 +536,24 @@ | |
138 | { | |
139 | register int i; | |
140 | register struct fstab *dt; | |
141 | - register struct dumpdates *dtwalk; | |
142 | + register struct dumpdates *dtwalk=NULL; | |
143 | char *lastname, *date; | |
144 | int dumpme; | |
145 | time_t tnow; | |
146 | ||
147 | (void) time(&tnow); | |
148 | getfstab(); /* /etc/fstab input */ | |
149 | - initdumptimes(); /* /etc/dumpdates input */ | |
150 | - qsort((char *) ddatev, nddates, sizeof(struct dumpdates *), datesort); | |
151 | - | |
152 | - if (arg == 'w') | |
153 | - (void) printf("Dump these file systems:\n"); | |
154 | - else | |
155 | + initdumptimes(0); /* /etc/dumpdates input */ | |
156 | + if (*ddatev != NULL) | |
157 | + { | |
158 | + qsort((char *) ddatev, nddates, sizeof(struct dumpdates *), datesort); | |
159 | + | |
160 | + if (arg == 'w') | |
161 | + (void) printf("Dump these file systems:\n"); | |
162 | + else | |
163 | (void) printf("Last dump(s) done (Dump '>' file systems):\n"); | |
164 | - lastname = "??"; | |
165 | - ITITERATE(i, dtwalk) { | |
166 | + lastname = "??"; | |
167 | + ITITERATE(i, dtwalk) { | |
168 | if (strncmp(lastname, dtwalk->dd_name, | |
169 | sizeof(dtwalk->dd_name)) == 0) | |
170 | continue; | |
171 | @@ -568,6 +572,7 @@ | |
172 | dt ? dt->fs_file : "", | |
173 | dtwalk->dd_level, | |
174 | date); | |
175 | + } | |
176 | } | |
177 | } | |
178 |