1 Fix libmount build under uClibc
3 See https://bugs.gentoo.org/show_bug.cgi?id=406303
4 http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-apps/util-linux/files/util-linux-2.21.1-no-printf-alloc.patch?revision=1.2
6 [Gustavo: Ported to util-linux-2.26]
8 Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
10 diff -Nura util-linux-2.26.orig/configure.ac util-linux-2.26/configure.ac
11 --- util-linux-2.26.orig/configure.ac 2015-02-19 09:11:13.146192401 -0300
12 +++ util-linux-2.26/configure.ac 2015-02-20 08:13:32.740006582 -0300
15 UL_BUILD_INIT([libmount])
16 UL_REQUIRES_BUILD([libmount], [libblkid])
17 -UL_REQUIRES_HAVE([libmount], [scanf_alloc_modifier], [scanf string alloc modifier])
18 AM_CONDITIONAL([BUILD_LIBMOUNT], [test "x$build_libmount" = xyes])
19 AM_CONDITIONAL([BUILD_LIBMOUNT_TESTS], [test "x$build_libmount" = xyes -a "x$enable_static" = xyes])
21 diff -Nura util-linux-2.26.orig/libmount/src/tab_parse.c util-linux-2.26/libmount/src/tab_parse.c
22 --- util-linux-2.26.orig/libmount/src/tab_parse.c 2015-02-16 09:57:34.070017496 -0300
23 +++ util-linux-2.26/libmount/src/tab_parse.c 2015-02-20 08:13:32.741006617 -0300
25 #include "pathnames.h"
28 +#ifndef HAVE_SCANF_MS_MODIFIER
29 +# define UL_SCNsA "%s"
32 static int next_number(char **s, int *num)
37 char *src = NULL, *fstype = NULL, *optstr = NULL;
39 +#ifndef HAVE_SCANF_MS_MODIFIER
40 + size_t len = strlen(s) + 1;
42 + fstype = malloc(len);
43 + fs->target = malloc(len);
44 + optstr = malloc(len);
47 rc = sscanf(s, UL_SCNsA" " /* (1) source */
48 UL_SCNsA" " /* (2) target */
49 UL_SCNsA" " /* (3) FS type */
50 UL_SCNsA" " /* (4) options */
51 "%n", /* byte count */
53 +#ifdef HAVE_SCANF_MS_MODIFIER
68 unsigned int maj, min;
69 char *fstype = NULL, *src = NULL, *p;
71 +#ifndef HAVE_SCANF_MS_MODIFIER
72 + size_t len = strlen(s) + 1;
73 + fs->root = malloc(len);
74 + fs->target = malloc(len);
75 + fs->vfs_optstr = malloc(len);
76 + fs->fs_optstr = malloc(len);
77 + fstype = malloc(len);
81 rc = sscanf(s, "%d " /* (1) id */
82 "%d " /* (2) parent */
83 "%u:%u " /* (3) maj:min */
88 +#ifdef HAVE_SCANF_MS_MODIFIER
99 if (rc >= 7 && end > 0)
101 UL_SCNsA" " /* (9) source */
102 UL_SCNsA, /* (10) fs options (fs specific) */
104 +#ifdef HAVE_SCANF_MS_MODIFIER
116 @@ -281,14 +322,25 @@
120 +#ifndef HAVE_SCANF_MS_MODIFIER
121 + size_t len = strlen(s) + 1;
123 + fs->swaptype = malloc(len);
126 rc = sscanf(s, UL_SCNsA" " /* (1) source */
127 UL_SCNsA" " /* (2) type */
132 +#ifdef HAVE_SCANF_MS_MODIFIER