if attempts to translate name fails, return original
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Wed, 7 Dec 1994 02:53:19 +0000 (18:53 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Wed, 7 Dec 1994 02:53:19 +0000 (18:53 -0800)
SCCS-vsn: sbin/fsck/preen.c 8.3

usr/src/sbin/fsck/preen.c

index 975e7d8..62c6ef8 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)preen.c    8.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)preen.c    8.3 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -248,42 +248,43 @@ startdisk(dk, checkit)
 }
 
 char *
 }
 
 char *
-blockcheck(name)
-       char *name;
+blockcheck(origname)
+       char *origname;
 {
        struct stat stslash, stblock, stchar;
 {
        struct stat stslash, stblock, stchar;
-       char *raw;
+       char *newname, *raw;
        int retried = 0;
 
        hotroot = 0;
        if (stat("/", &stslash) < 0) {
                perror("/");
                printf("Can't stat root\n");
        int retried = 0;
 
        hotroot = 0;
        if (stat("/", &stslash) < 0) {
                perror("/");
                printf("Can't stat root\n");
-               return (0);
+               return (origname);
        }
        }
+       newname = origname;
 retry:
 retry:
-       if (stat(name, &stblock) < 0) {
-               perror(name);
-               printf("Can't stat %s\n", name);
-               return (0);
+       if (stat(newname, &stblock) < 0) {
+               perror(newname);
+               printf("Can't stat %s\n", newname);
+               return (origname);
        }
        if ((stblock.st_mode & S_IFMT) == S_IFBLK) {
                if (stslash.st_dev == stblock.st_rdev)
                        hotroot++;
        }
        if ((stblock.st_mode & S_IFMT) == S_IFBLK) {
                if (stslash.st_dev == stblock.st_rdev)
                        hotroot++;
-               raw = rawname(name);
+               raw = rawname(newname);
                if (stat(raw, &stchar) < 0) {
                        perror(raw);
                        printf("Can't stat %s\n", raw);
                if (stat(raw, &stchar) < 0) {
                        perror(raw);
                        printf("Can't stat %s\n", raw);
-                       return (name);
+                       return (origname);
                }
                if ((stchar.st_mode & S_IFMT) == S_IFCHR) {
                        return (raw);
                } else {
                        printf("%s is not a character device\n", raw);
                }
                if ((stchar.st_mode & S_IFMT) == S_IFCHR) {
                        return (raw);
                } else {
                        printf("%s is not a character device\n", raw);
-                       return (name);
+                       return (origname);
                }
        } else if ((stblock.st_mode & S_IFMT) == S_IFCHR && !retried) {
                }
        } else if ((stblock.st_mode & S_IFMT) == S_IFCHR && !retried) {
-               name = unrawname(name);
+               newname = unrawname(newname);
                retried++;
                goto retry;
        }
                retried++;
                goto retry;
        }
@@ -291,7 +292,7 @@ retry:
         * Not a block or character device, just return name and
         * let the user decide whether to use it.
         */
         * Not a block or character device, just return name and
         * let the user decide whether to use it.
         */
-       return (name);
+       return (origname);
 }
 
 char *
 }
 
 char *