X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=dump%2Foptr.c;h=410253762486f27aecdf72920fe6663dd115fd8d;hb=4f94452b3d04736ed24c99d1f267853f818528d5;hp=b17cd556bbf871ce97839e98201b36a33061cd9b;hpb=df9ae507502f413c72119dde6ea3d35c91dba5bf;p=dump.git diff --git a/dump/optr.c b/dump/optr.c index b17cd55..4102537 100644 --- a/dump/optr.c +++ b/dump/optr.c @@ -2,7 +2,7 @@ * Ported to Linux's Second Extended File System as part of the * dump and restore backup suit * Remy Card , 1994-1997 - * Stelian Pop , 1999 + * Stelian Pop , 1999-2000 */ /*- @@ -40,7 +40,7 @@ #ifndef lint static const char rcsid[] = - "$Id: optr.c,v 1.6 1999/10/13 09:57:20 stelian Exp $"; + "$Id: optr.c,v 1.11 2000/08/19 23:15:38 stelian Exp $"; #endif /* not lint */ #include @@ -328,6 +328,8 @@ timeest(void) tschedule = tnow + 300; if (blockswritten < 500) return; + if (blockswritten > tapesize) + tapesize = blockswritten; deltat = tstart_writing - tnow + (1.0 * (tnow - tstart_writing)) / blockswritten * tapesize; @@ -358,8 +360,14 @@ msg(fmt, va_alist) va_start(ap); #endif (void) vfprintf(stderr, fmt, ap); + va_end(ap); (void) fflush(stdout); (void) fflush(stderr); +#ifdef __STDC__ + va_start(ap, fmt); +#else + va_start(ap); +#endif (void) vsnprintf(lastmsg, sizeof(lastmsg), fmt, ap); va_end(ap); } @@ -421,8 +429,11 @@ allocfsent(struct fstab *fs) register struct fstab *new; new = (struct fstab *)malloc(sizeof (*fs)); - if (new == NULL || - (new->fs_file = strdup(fs->fs_file)) == NULL || + if (new == NULL) + quit("%s\n", strerror(errno)); + if (strlen(fs->fs_file) > 1 && fs->fs_file[strlen(fs->fs_file) - 1] == '/') + fs->fs_file[strlen(fs->fs_file) - 1] = '\0'; + if ((new->fs_file = strdup(fs->fs_file)) == NULL || (new->fs_type = strdup(fs->fs_type)) == NULL || (new->fs_spec = strdup(fs->fs_spec)) == NULL) quit("%s\n", strerror(errno)); @@ -518,7 +529,7 @@ fstabsearchdir(const char *key, char *directory) for (pf = table; pf != NULL; pf = pf->pf_next) { fs = pf->pf_fstab; if (strlen(fs->fs_file) > size && - strlen(key) > strlen(fs->fs_file) + 2 && + strlen(key) > strlen(fs->fs_file) + 1 && strncmp(fs->fs_file, key, strlen(fs->fs_file)) == 0 && (key[strlen(fs->fs_file)] == '/' || fs->fs_file[strlen(fs->fs_file) - 1] == '/')) {