From 8f3f6383a581e64d5dbe9a13130e078f45babf07 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 1 Oct 2010 13:05:58 +0200 Subject: libmount: rewrite mountinfo/fstab parsers to use sscanf() The old solution (without scanf()) was based on old code from mount(8). It seems that the modern libc is able to provide all necessary functionality by sscanf() and %ms directive. Signed-off-by: Karel Zak --- lib/mangle.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/mangle.c b/lib/mangle.c index e320cfb7..938dd8e5 100644 --- a/lib/mangle.c +++ b/lib/mangle.c @@ -115,10 +115,19 @@ int main(int argc, char *argv[]) else if (!strcmp(argv[1], "--unmangle")) { char *x = unmangle(argv[2]); - if (x) + + if (x) { printf("unmangled: '%s'\n", x); - else - err(EXIT_FAILURE, "unmangle failed"); + free(x); + } + + x = strdup(argv[2]); + unmangle_to_buffer(x, x, strlen(x) + 1); + + if (x) { + printf("self-unmangled: '%s'\n", x); + free(x); + } } return EXIT_SUCCESS; -- cgit v1.2.3