]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
Revert "mountpoint: refactor exit path"
authorKarel Zak <kzak@redhat.com>
Tue, 11 Oct 2011 09:14:31 +0000 (11:14 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 11 Oct 2011 09:14:31 +0000 (11:14 +0200)
This change is unnecessary, we can use libmount stuff for everything.

This reverts commit b16b56ec55507b6b83e0d35e3cefeb16367f3363.

sys-utils/mountpoint.c

index 16c7c2271db9c2663f0002c2cc5d728a8b839796..1182f7c3bda108211ca3c436790a31b2bcd253d7 100644 (file)
@@ -116,7 +116,7 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
 
 int main(int argc, char **argv)
 {
-       int c, fs_devno = 0, dev_devno = 0, rc = EXIT_FAILURE;
+       int c, fs_devno = 0, dev_devno = 0, rc = 0;
        char *spec;
        struct stat st;
 
@@ -162,36 +162,30 @@ int main(int argc, char **argv)
 
        if (stat(spec, &st)) {
                if (!quiet)
-                       warn("%s", spec);
-               goto finish;
+                       err(EXIT_FAILURE, "%s", spec);
+               return EXIT_FAILURE;
        }
-
-       if (dev_devno) {
-               if (print_devno(spec, &st) == 0)
-                       rc = EXIT_SUCCESS;
-       } else {
+       if (dev_devno)
+               rc = print_devno(spec, &st);
+       else {
                dev_t src;
 
                if (!S_ISDIR(st.st_mode)) {
                        if (!quiet)
-                               warnx(_("%s: not a directory"), spec);
-                       goto finish;
+                               errx(EXIT_FAILURE, _("%s: not a directory"), spec);
+                       return EXIT_FAILURE;
                }
                src = dir_to_device(spec);
                if (!src) {
                        if (!quiet)
                                printf(_("%s is not a mountpoint\n"), spec);
-                       goto finish;
+                       return EXIT_FAILURE;
                }
-
-               rc = EXIT_SUCCESS;
-
                if (fs_devno)
                        printf("%u:%u\n", major(src), minor(src));
                else if (!quiet)
                        printf(_("%s is a mountpoint\n"), spec);
        }
 
-finish:
-       return rc;
+       return rc ? EXIT_FAILURE : EXIT_SUCCESS;
 }