diff options
author | Karel Zak | 2012-03-20 09:55:24 +0100 |
---|---|---|
committer | Karel Zak | 2012-03-20 09:55:24 +0100 |
commit | d7bcb2052ebef1b815556b1ad70441c7a7daa385 (patch) | |
tree | 511c39b9606c38b82d46b92b8eac468b1aacac4f /misc-utils/findmnt.c | |
parent | include/ttyutils.h: add include guards (diff) | |
download | kernel-qcow2-util-linux-d7bcb2052ebef1b815556b1ad70441c7a7daa385.tar.gz kernel-qcow2-util-linux-d7bcb2052ebef1b815556b1ad70441c7a7daa385.tar.xz kernel-qcow2-util-linux-d7bcb2052ebef1b815556b1ad70441c7a7daa385.zip |
findmnt: use xasprintf()
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils/findmnt.c')
-rw-r--r-- | misc-utils/findmnt.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c index acaedfc56..f985ed0d9 100644 --- a/misc-utils/findmnt.c +++ b/misc-utils/findmnt.c @@ -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) { |