* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
#ifndef lint
static const char rcsid[] =
- "$Id: main.c,v 1.41 2002/07/19 14:57:39 stelian Exp $";
+ "$Id: main.c,v 1.44 2003/03/30 15:40:38 stelian Exp $";
#endif /* not lint */
#include <config.h>
long dumpnum = 1;
long volno = 0;
long ntrec;
-char *dumpmap;
-char *usedinomap;
+char *dumpmap = NULL;
+char *usedinomap = NULL;
dump_ino_t maxino;
time_t dumptime;
time_t dumpdate;
static void usage __P((void));
static void use_stdin __P((const char *));
+#define FORCED_UMASK (077)
+
int
main(int argc, char *argv[])
{
char *p, name[MAXPATHLEN];
FILE *filelist = NULL;
char fname[MAXPATHLEN];
+ mode_t orig_umask;
#ifdef DEBUG_QFA
time_t tistart, tiend, titaken;
#endif
#endif /* USE_QFA */
/* Temp files should *not* be readable. We set permissions later. */
- (void) umask(077);
+ orig_umask = umask(FORCED_UMASK);
filesys[0] = '\0';
#if defined(__linux__) || defined(sunos)
__progname = argv[0];
#endif
setup();
msg("writing QFA positions to %s\n", gTapeposfile);
- if ((gTapeposfd = open(gTapeposfile, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR)) < 0)
+ (void) umask(orig_umask);
+ if ((gTapeposfd = open(gTapeposfile, O_WRONLY|O_CREAT|O_TRUNC,
+ S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP
+ |S_IROTH|S_IWOTH)) < 0)
errx(1, "can't create tapeposfile\n");
+ (void) umask(FORCED_UMASK);
/* print QFA-file header */
sprintf(gTps, "%s\n%s\n%ld\n\n", QFA_MAGIC, QFA_VERSION,(unsigned long)spcl.c_date);
if (write(gTapeposfd, gTps, strlen(gTps)) != (ssize_t)strlen(gTps))