X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=dump%2Foptr.c;h=fdda1c4e594ef67297377982731e2ec7eeff4cec;hb=20c345aa6780d2b021ce6cdbd812e4f021273640;hp=41aa20e4b3b6242c896859c67f83d6934995e7c8;hpb=3072400e170260407c3739f5c2255136f3e55a04;p=dump.git diff --git a/dump/optr.c b/dump/optr.c index 41aa20e..fdda1c4 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.9 2000/01/26 11:38:08 stelian Exp $"; #endif /* not lint */ #include @@ -427,8 +427,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));