2013-03-07 13:46:37 +01:00
|
|
|
Fix libmount build under uClibc
|
2012-03-15 11:06:36 +01:00
|
|
|
|
2013-03-07 13:46:37 +01:00
|
|
|
See https://bugs.gentoo.org/show_bug.cgi?id=406303
|
2013-09-05 15:32:26 +02:00
|
|
|
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
|
2012-03-15 11:06:36 +01:00
|
|
|
|
2015-02-20 13:10:19 +01:00
|
|
|
[Gustavo: Ported to util-linux-2.26]
|
2014-09-08 17:20:52 +02:00
|
|
|
|
|
|
|
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
|
|
|
|
|
2015-02-20 13:10:19 +01:00
|
|
|
diff -Nura util-linux-2.26.orig/configure.ac util-linux-2.26/configure.ac
|
|
|
|
--- util-linux-2.26.orig/configure.ac 2015-02-19 09:11:13.146192401 -0300
|
|
|
|
+++ util-linux-2.26/configure.ac 2015-02-20 08:13:32.740006582 -0300
|
|
|
|
@@ -840,7 +840,6 @@
|
|
|
|
)
|
2013-03-07 13:46:37 +01:00
|
|
|
UL_BUILD_INIT([libmount])
|
|
|
|
UL_REQUIRES_BUILD([libmount], [libblkid])
|
|
|
|
-UL_REQUIRES_HAVE([libmount], [scanf_alloc_modifier], [scanf string alloc modifier])
|
2014-04-03 16:40:52 +02:00
|
|
|
AM_CONDITIONAL([BUILD_LIBMOUNT], [test "x$build_libmount" = xyes])
|
|
|
|
AM_CONDITIONAL([BUILD_LIBMOUNT_TESTS], [test "x$build_libmount" = xyes -a "x$enable_static" = xyes])
|
2013-09-05 22:55:03 +02:00
|
|
|
|
2015-02-20 13:10:19 +01:00
|
|
|
diff -Nura util-linux-2.26.orig/libmount/src/tab_parse.c util-linux-2.26/libmount/src/tab_parse.c
|
|
|
|
--- util-linux-2.26.orig/libmount/src/tab_parse.c 2015-02-16 09:57:34.070017496 -0300
|
|
|
|
+++ util-linux-2.26/libmount/src/tab_parse.c 2015-02-20 08:13:32.741006617 -0300
|
2013-09-05 15:32:26 +02:00
|
|
|
@@ -22,6 +22,10 @@
|
|
|
|
#include "pathnames.h"
|
|
|
|
#include "strutils.h"
|
|
|
|
|
|
|
|
+#ifndef HAVE_SCANF_MS_MODIFIER
|
|
|
|
+# define UL_SCNsA "%s"
|
|
|
|
+#endif
|
|
|
|
+
|
2014-09-08 17:20:52 +02:00
|
|
|
static int next_number(char **s, int *num)
|
2012-03-15 11:06:36 +01:00
|
|
|
{
|
2014-09-08 17:20:52 +02:00
|
|
|
char *end = NULL;
|
|
|
|
@@ -52,16 +56,31 @@
|
2013-09-05 15:32:26 +02:00
|
|
|
int rc, n = 0, xrc;
|
|
|
|
char *src = NULL, *fstype = NULL, *optstr = NULL;
|
|
|
|
|
|
|
|
+#ifndef HAVE_SCANF_MS_MODIFIER
|
|
|
|
+ size_t len = strlen(s) + 1;
|
|
|
|
+ src = malloc(len);
|
|
|
|
+ fstype = malloc(len);
|
|
|
|
+ fs->target = malloc(len);
|
|
|
|
+ optstr = malloc(len);
|
|
|
|
+#endif
|
2012-03-15 11:06:36 +01:00
|
|
|
+
|
2013-09-05 15:32:26 +02:00
|
|
|
rc = sscanf(s, UL_SCNsA" " /* (1) source */
|
|
|
|
UL_SCNsA" " /* (2) target */
|
|
|
|
UL_SCNsA" " /* (3) FS type */
|
|
|
|
UL_SCNsA" " /* (4) options */
|
2012-03-15 11:06:36 +01:00
|
|
|
"%n", /* byte count */
|
|
|
|
|
2013-09-05 15:32:26 +02:00
|
|
|
+#ifdef HAVE_SCANF_MS_MODIFIER
|
|
|
|
&src,
|
|
|
|
&fs->target,
|
|
|
|
&fstype,
|
|
|
|
&optstr,
|
|
|
|
+#else
|
2012-03-15 11:06:36 +01:00
|
|
|
+ src,
|
|
|
|
+ fs->target,
|
|
|
|
+ fstype,
|
|
|
|
+ optstr,
|
2013-09-05 15:32:26 +02:00
|
|
|
+#endif
|
2012-03-15 11:06:36 +01:00
|
|
|
&n);
|
2013-09-05 15:32:26 +02:00
|
|
|
xrc = rc;
|
2012-03-15 11:06:36 +01:00
|
|
|
|
2014-09-08 17:20:52 +02:00
|
|
|
@@ -127,6 +146,16 @@
|
2012-03-15 11:06:36 +01:00
|
|
|
unsigned int maj, min;
|
2013-09-05 15:32:26 +02:00
|
|
|
char *fstype = NULL, *src = NULL, *p;
|
2012-03-15 11:06:36 +01:00
|
|
|
|
2013-09-05 15:32:26 +02:00
|
|
|
+#ifndef HAVE_SCANF_MS_MODIFIER
|
|
|
|
+ size_t len = strlen(s) + 1;
|
|
|
|
+ fs->root = malloc(len);
|
|
|
|
+ fs->target = malloc(len);
|
|
|
|
+ fs->vfs_optstr = malloc(len);
|
|
|
|
+ fs->fs_optstr = malloc(len);
|
|
|
|
+ fstype = malloc(len);
|
|
|
|
+ src = malloc(len);
|
|
|
|
+#endif
|
2012-03-15 11:06:36 +01:00
|
|
|
+
|
2014-09-08 17:20:52 +02:00
|
|
|
rc = sscanf(s, "%d " /* (1) id */
|
|
|
|
"%d " /* (2) parent */
|
2012-03-15 11:06:36 +01:00
|
|
|
"%u:%u " /* (3) maj:min */
|
2014-09-08 17:20:52 +02:00
|
|
|
@@ -138,9 +167,15 @@
|
2012-03-15 11:06:36 +01:00
|
|
|
&fs->id,
|
2013-09-05 15:32:26 +02:00
|
|
|
&fs->parent,
|
|
|
|
&maj, &min,
|
|
|
|
+#ifdef HAVE_SCANF_MS_MODIFIER
|
|
|
|
&fs->root,
|
|
|
|
&fs->target,
|
|
|
|
&fs->vfs_optstr,
|
|
|
|
+#else
|
|
|
|
+ fs->root,
|
|
|
|
+ fs->target,
|
|
|
|
+ fs->vfs_optstr,
|
|
|
|
+#endif
|
|
|
|
&end);
|
2012-03-15 11:06:36 +01:00
|
|
|
|
2013-09-05 15:32:26 +02:00
|
|
|
if (rc >= 7 && end > 0)
|
2014-09-08 17:20:52 +02:00
|
|
|
@@ -160,9 +195,15 @@
|
2013-09-05 15:32:26 +02:00
|
|
|
UL_SCNsA" " /* (9) source */
|
|
|
|
UL_SCNsA, /* (10) fs options (fs specific) */
|
2012-03-15 11:06:36 +01:00
|
|
|
|
2013-09-05 15:32:26 +02:00
|
|
|
+#ifdef HAVE_SCANF_MS_MODIFIER
|
2012-03-15 11:06:36 +01:00
|
|
|
&fstype,
|
|
|
|
&src,
|
2013-09-05 15:32:26 +02:00
|
|
|
&fs->fs_optstr);
|
|
|
|
+#else
|
|
|
|
+ fstype,
|
|
|
|
+ src,
|
|
|
|
+ fs->fs_optstr);
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
if (rc >= 10) {
|
2014-09-08 17:20:52 +02:00
|
|
|
size_t sz;
|
|
|
|
@@ -281,14 +322,25 @@
|
2013-09-05 15:32:26 +02:00
|
|
|
int rc;
|
|
|
|
char *src = NULL;
|
|
|
|
|
|
|
|
+#ifndef HAVE_SCANF_MS_MODIFIER
|
|
|
|
+ size_t len = strlen(s) + 1;
|
|
|
|
+ src = malloc(len);
|
|
|
|
+ fs->swaptype = malloc(len);
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
rc = sscanf(s, UL_SCNsA" " /* (1) source */
|
|
|
|
UL_SCNsA" " /* (2) type */
|
2014-09-08 17:20:52 +02:00
|
|
|
"%ju" /* (3) size */
|
|
|
|
"%ju" /* (4) used */
|
2013-09-05 15:32:26 +02:00
|
|
|
"%d", /* priority */
|
|
|
|
|
2013-11-28 14:56:06 +01:00
|
|
|
+#ifdef HAVE_SCANF_MS_MODIFIER
|
2013-09-05 15:32:26 +02:00
|
|
|
&src,
|
|
|
|
&fs->swaptype,
|
|
|
|
+#else
|
|
|
|
+ src,
|
|
|
|
+ fs->swaptype,
|
|
|
|
+#endif
|
|
|
|
&fsz,
|
|
|
|
&usz,
|
|
|
|
&fs->priority);
|