From: Karel Zak Date: Tue, 20 Mar 2012 08:55:24 +0000 (+0100) Subject: findmnt: use xasprintf() X-Git-Tag: v2.22-rc1~641 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d7bcb2052ebef1b815556b1ad70441c7a7daa385;p=thirdparty%2Futil-linux.git findmnt: use xasprintf() Signed-off-by: Karel Zak --- diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c index acaedfc569..f985ed0d9a 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) {