X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=dump%2Foptr.c;h=410253762486f27aecdf72920fe6663dd115fd8d;hb=79e318657e7faa7b2951ff554dc6f1b92624a477;hp=41aa20e4b3b6242c896859c67f83d6934995e7c8;hpb=3072400e170260407c3739f5c2255136f3e55a04;p=dump.git diff --git a/dump/optr.c b/dump/optr.c index 41aa20e..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.7 1999/10/18 09:48:00 tiniou 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; @@ -427,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)); @@ -524,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] == '/')) {