]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
findmnt: use xasprintf()
authorKarel Zak <kzak@redhat.com>
Tue, 20 Mar 2012 08:55:24 +0000 (09:55 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 20 Mar 2012 08:55:24 +0000 (09:55 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/findmnt.c

index acaedfc569db3eecc23fac56b9da4b7b12b72f22..f985ed0d9aec2b368b847d8801705259f4ff7a7f 100644 (file)
@@ -314,10 +314,9 @@ static const char *get_vfs_attr(struct libmnt_fs *fs, int sizetype)
                if (buf.f_blocks == 0)
                        return "-";
 
-               if (asprintf(&sizestr, "%.0f%%",
-                                       (double)(buf.f_blocks - buf.f_bfree) /
-                                       buf.f_blocks * 100) == -1)
-                       err(EXIT_FAILURE, "failed to allocate string");
+               xasprintf(&sizestr, "%.0f%%",
+                               (double)(buf.f_blocks - buf.f_bfree) /
+                               buf.f_blocks * 100);
                return sizestr;
        }
 
@@ -326,7 +325,6 @@ static const char *get_vfs_attr(struct libmnt_fs *fs, int sizetype)
 }
 
 /* reads FS data from libmount
- * TODO: add function that will deallocate data allocated by get_data()
  */
 static const char *get_data(struct libmnt_fs *fs, int num)
 {