]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
blkid: fix exit codes in blkid(8)
authorScott James Remnant <scott@ubuntu.com>
Tue, 24 Mar 2009 12:15:38 +0000 (13:15 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 24 Mar 2009 12:15:38 +0000 (13:15 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
libs/blkid/bin/blkid.c

index 92183212a2bd65b88684ae17583d50a954953112..620344e4bdf5c725c40b481c324489fb944f43b4 100644 (file)
@@ -528,11 +528,13 @@ int main(int argc, char **argv)
        if (!lowprobe && !eval && blkid_get_cache(&cache, read) < 0)
                goto exit;
 
-       err = 2;
        if (gc) {
                blkid_gc_cache(cache);
+               err = 0;
                goto exit;
        }
+       err = 2;
+
        if (output_format & OUTPUT_PRETTY_LIST)
                pretty_print_dev(NULL);
 
@@ -566,8 +568,10 @@ int main(int argc, char **argv)
                 * Evaluate API
                 */
                char *res = blkid_evaluate_spec(search_type, search_value, NULL);
-               if (res)
+               if (res) {
+                       err = 0;
                        printf("%s\n", res);
+               }
        } else if (lookup) {
                /*
                 * Classic (cache based) API