]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
findmnt: simplify cache_set_targets()
authorKarel Zak <kzak@redhat.com>
Tue, 1 Jul 2014 08:36:40 +0000 (10:36 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 1 Jul 2014 08:36:40 +0000 (10:36 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/findmnt.c

index 0b3e380fb6115ed5ebee7846de19084852ad9c2f..847c349a2c0a5f41e077b2924da6d3866ab65bc5 100644 (file)
@@ -839,27 +839,20 @@ static struct libmnt_table *parse_tabfiles(char **files,
  */
 static void cache_set_targets(struct libmnt_cache *cache)
 {
-       struct libmnt_table *tb = NULL;
-       char *path = NULL;
-       int rc = 0;
+       struct libmnt_table *tb;
+       const char *path;
 
        tb = mnt_new_table();
        if (!tb)
-               goto done;
+               return;
 
        path = access(_PATH_PROC_MOUNTINFO, R_OK) == 0 ?
                _PATH_PROC_MOUNTINFO :
                _PATH_PROC_MOUNTS;
 
-       rc = mnt_table_parse_file(tb, path);
-       if (rc)
-               goto done;
+       if (mnt_table_parse_file(tb, path) == 0)
+               mnt_cache_set_targets(cache, tb);
 
-       rc = mnt_cache_set_targets(cache, tb);
-       if (rc)
-               goto done;
-
-done:
        mnt_unref_table(tb);
 }