From c9f25410c99f4060bf8622da6bb14f41d3f73a74 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Fri, 19 Mar 2004 15:52:22 +0000 Subject: [PATCH] Avoid sscanf %as for uClibc --- tools/dmsetup.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tools/dmsetup.c b/tools/dmsetup.c index cec22e557..808027cb1 100644 --- a/tools/dmsetup.c +++ b/tools/dmsetup.c @@ -63,7 +63,7 @@ static char *_uuid; */ static int _parse_file(struct dm_task *dmt, const char *file) { - char buffer[LINE_SIZE], *ttype, *ptr, *comment; + char buffer[LINE_SIZE], ttype[LINE_SIZE], *ptr, *comment; FILE *fp; unsigned long long start, size; int r = 0, n, line = 0; @@ -94,8 +94,8 @@ static int _parse_file(struct dm_task *dmt, const char *file) if (!*ptr || *ptr == '#') continue; - if (sscanf(ptr, "%llu %llu %as %n", - &start, &size, &ttype, &n) < 3) { + if (sscanf(ptr, "%llu %llu %s %n", + &start, &size, ttype, &n) < 3) { err("%s:%d Invalid format", file, line); goto out; } @@ -106,8 +106,6 @@ static int _parse_file(struct dm_task *dmt, const char *file) if (!dm_task_add_target(dmt, start, size, ttype, ptr)) goto out; - - free(ttype); } r = 1;