|
@@ -1,13 +1,12 @@
|
|
Fix libmount build under uClibc
|
|
Fix libmount build under uClibc
|
|
|
|
|
|
See https://bugs.gentoo.org/show_bug.cgi?id=406303
|
|
See https://bugs.gentoo.org/show_bug.cgi?id=406303
|
|
-Patch from http://repository.timesys.com/buildsources/u/util-linux/util-linux-2.21.2/util-linux-2.21.2-sscanf-no-ms-as.patch ported to util-linux-2.22.2
|
|
|
|
|
|
+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
|
|
|
|
+ported to util-linux-2.23.2
|
|
|
|
|
|
-Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
|
|
|
|
-
|
|
|
|
-diff -Nura util-linux-2.22.2/configure.ac util-linux-2.22.2-sscanf-no-ms-as/configure.ac
|
|
|
|
---- util-linux-2.22.2/configure.ac 2012-12-13 08:16:02.973822890 -0300
|
|
|
|
-+++ util-linux-2.22.2-sscanf-no-ms-as/configure.ac 2013-03-07 14:50:39.975512873 -0300
|
|
|
|
|
|
+diff -Nura a/configure.ac b/configure.ac
|
|
|
|
+--- a/configure.ac 2012-12-13 08:16:02.973822890 -0300
|
|
|
|
++++ b/configure.ac 2013-03-07 14:50:39.975512873 -0300
|
|
@@ -733,7 +733,6 @@
|
|
@@ -733,7 +733,6 @@
|
|
UL_BUILD_INIT([libmount])
|
|
UL_BUILD_INIT([libmount])
|
|
UL_REQUIRES_LINUX([libmount])
|
|
UL_REQUIRES_LINUX([libmount])
|
|
@@ -16,99 +15,124 @@ diff -Nura util-linux-2.22.2/configure.ac util-linux-2.22.2-sscanf-no-ms-as/conf
|
|
AM_CONDITIONAL(BUILD_LIBMOUNT, test "x$build_libmount" = xyes)
|
|
AM_CONDITIONAL(BUILD_LIBMOUNT, test "x$build_libmount" = xyes)
|
|
AM_CONDITIONAL(BUILD_LIBMOUNT_TESTS, test "x$build_libmount" = xyes -a "x$enable_static" = xyes)
|
|
AM_CONDITIONAL(BUILD_LIBMOUNT_TESTS, test "x$build_libmount" = xyes -a "x$enable_static" = xyes)
|
|
|
|
|
|
-diff -Nura util-linux-2.22.2/libmount/src/tab_parse.c util-linux-2.22.2-sscanf-no-ms-as/libmount/src/tab_parse.c
|
|
|
|
---- util-linux-2.22.2/libmount/src/tab_parse.c 2012-12-12 17:04:47.906355128 -0300
|
|
|
|
-+++ util-linux-2.22.2-sscanf-no-ms-as/libmount/src/tab_parse.c 2013-03-07 15:08:29.589503961 -0300
|
|
|
|
-@@ -58,19 +58,21 @@
|
|
|
|
- */
|
|
|
|
- static int mnt_parse_table_line(struct libmnt_fs *fs, char *s)
|
|
|
|
|
|
+diff -Nura a/libmount/src/tab_parse.c b/libmount/src/tab_parse.c
|
|
|
|
+--- a/libmount/src/tab_parse.c 2013-07-30 03:39:26.218738358 -0500
|
|
|
|
++++ b/libmount/src/tab_parse.c 2013-09-04 11:22:26.332917445 -0500
|
|
|
|
+@@ -22,6 +22,10 @@
|
|
|
|
+ #include "pathnames.h"
|
|
|
|
+ #include "strutils.h"
|
|
|
|
+
|
|
|
|
++#ifndef HAVE_SCANF_MS_MODIFIER
|
|
|
|
++# define UL_SCNsA "%s"
|
|
|
|
++#endif
|
|
|
|
++
|
|
|
|
+ static inline char *skip_spaces(char *s)
|
|
{
|
|
{
|
|
-- int rc, n = 0, xrc;
|
|
|
|
-- char *src = NULL, *fstype = NULL, *optstr = NULL;
|
|
|
|
--
|
|
|
|
-- rc = sscanf(s, UL_SCNsA" " /* (1) source */
|
|
|
|
-- UL_SCNsA" " /* (2) target */
|
|
|
|
-- UL_SCNsA" " /* (3) FS type */
|
|
|
|
-- UL_SCNsA" " /* (4) options */
|
|
|
|
-+ int rc, n = 0, len = strlen (s) + 1, xrc;
|
|
|
|
-+ char *src = malloc (sizeof *src * len);
|
|
|
|
-+ char *fstype = malloc (sizeof *fstype * len);
|
|
|
|
-+ char *optstr = malloc (sizeof *optstr * len);
|
|
|
|
|
|
+ assert(s);
|
|
|
|
+@@ -61,16 +65,31 @@
|
|
|
|
+ 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
|
|
+
|
|
+
|
|
-+ rc = sscanf(s, "%s"" " /* (1) source */
|
|
|
|
-+ "%s"" " /* (2) target */
|
|
|
|
-+ "%s"" " /* (3) FS type */
|
|
|
|
-+ "%s"" " /* (4) options */
|
|
|
|
|
|
+ rc = sscanf(s, UL_SCNsA" " /* (1) source */
|
|
|
|
+ UL_SCNsA" " /* (2) target */
|
|
|
|
+ UL_SCNsA" " /* (3) FS type */
|
|
|
|
+ UL_SCNsA" " /* (4) options */
|
|
"%n", /* byte count */
|
|
"%n", /* byte count */
|
|
|
|
|
|
-- &src,
|
|
|
|
-- &fs->target,
|
|
|
|
-- &fstype,
|
|
|
|
-- &optstr,
|
|
|
|
|
|
++#ifdef HAVE_SCANF_MS_MODIFIER
|
|
|
|
+ &src,
|
|
|
|
+ &fs->target,
|
|
|
|
+ &fstype,
|
|
|
|
+ &optstr,
|
|
|
|
++#else
|
|
+ src,
|
|
+ src,
|
|
+ fs->target,
|
|
+ fs->target,
|
|
+ fstype,
|
|
+ fstype,
|
|
+ optstr,
|
|
+ optstr,
|
|
|
|
++#endif
|
|
&n);
|
|
&n);
|
|
- xrc = rc;
|
|
|
|
|
|
+ xrc = rc;
|
|
|
|
|
|
-@@ -132,16 +134,20 @@
|
|
|
|
- */
|
|
|
|
- static int mnt_parse_mountinfo_line(struct libmnt_fs *fs, char *s)
|
|
|
|
- {
|
|
|
|
-- int rc, end = 0;
|
|
|
|
-+ int rc, end = 0, len = strlen (s) + 1;
|
|
|
|
|
|
+@@ -136,6 +155,16 @@
|
|
unsigned int maj, min;
|
|
unsigned int maj, min;
|
|
- char *fstype = NULL, *src = NULL, *p;
|
|
|
|
|
|
+ char *fstype = NULL, *src = NULL, *p;
|
|
|
|
|
|
-+ fs->root = malloc (sizeof *fs->root * len);
|
|
|
|
-+ fs->target = malloc (sizeof *fs->target * len);
|
|
|
|
-+ fs->vfs_optstr = malloc (sizeof *fs->vfs_optstr * len);
|
|
|
|
|
|
++#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
|
|
+
|
|
+
|
|
rc = sscanf(s, "%u " /* (1) id */
|
|
rc = sscanf(s, "%u " /* (1) id */
|
|
"%u " /* (2) parent */
|
|
"%u " /* (2) parent */
|
|
"%u:%u " /* (3) maj:min */
|
|
"%u:%u " /* (3) maj:min */
|
|
-- UL_SCNsA" " /* (4) mountroot */
|
|
|
|
-- UL_SCNsA" " /* (5) target */
|
|
|
|
-- UL_SCNsA /* (6) vfs options (fs-independent) */
|
|
|
|
-+ "%s"" " /* (4) mountroot */
|
|
|
|
-+ "%s"" " /* (5) target */
|
|
|
|
-+ "%s" /* (6) vfs options (fs-independent) */
|
|
|
|
- "%n", /* number of read bytes */
|
|
|
|
-
|
|
|
|
|
|
+@@ -147,9 +176,15 @@
|
|
&fs->id,
|
|
&fs->id,
|
|
-@@ -163,9 +169,14 @@
|
|
|
|
- }
|
|
|
|
- s = p + 3;
|
|
|
|
|
|
+ &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);
|
|
|
|
|
|
-- rc += sscanf(s, UL_SCNsA" " /* (8) FS type */
|
|
|
|
-- UL_SCNsA" " /* (9) source */
|
|
|
|
-- UL_SCNsA, /* (10) fs options (fs specific) */
|
|
|
|
-+ len = strlen (s) + 1;
|
|
|
|
-+ fstype = malloc (sizeof *fstype * len);
|
|
|
|
-+ src = malloc (sizeof *src * len);
|
|
|
|
-+ fs->fs_optstr = malloc (sizeof *fs->fs_optstr * len);
|
|
|
|
-+
|
|
|
|
-+ rc += sscanf(s, "%s"" " /* (8) FS type */
|
|
|
|
-+ "%s"" " /* (9) source */
|
|
|
|
-+ "%s", /* (10) fs options (fs specific) */
|
|
|
|
|
|
+ if (rc >= 7 && end > 0)
|
|
|
|
+@@ -169,9 +204,15 @@
|
|
|
|
+ UL_SCNsA" " /* (9) source */
|
|
|
|
+ UL_SCNsA, /* (10) fs options (fs specific) */
|
|
|
|
|
|
|
|
++#ifdef HAVE_SCANF_MS_MODIFIER
|
|
&fstype,
|
|
&fstype,
|
|
&src,
|
|
&src,
|
|
-@@ -274,11 +285,12 @@
|
|
|
|
- static int mnt_parse_swaps_line(struct libmnt_fs *fs, char *s)
|
|
|
|
- {
|
|
|
|
- uintmax_t fsz, usz;
|
|
|
|
-- int rc;
|
|
|
|
-- char *src = NULL;
|
|
|
|
-+ int rc, len = strlen (s) + 1;
|
|
|
|
-+ char *src = malloc (sizeof *src * len);
|
|
|
|
-+ fs->swaptype = malloc (sizeof *fs->swaptype * len);
|
|
|
|
-
|
|
|
|
-- rc = sscanf(s, UL_SCNsA" " /* (1) source */
|
|
|
|
-- UL_SCNsA" " /* (2) type */
|
|
|
|
-+ rc = sscanf(s, "%s" /* (1) source */
|
|
|
|
-+ "%s" /* (2) type */
|
|
|
|
- "%jd" /* (3) size */
|
|
|
|
- "%jd" /* (4) used */
|
|
|
|
- "%d", /* priority */
|
|
|
|
|
|
+ &fs->fs_optstr);
|
|
|
|
++#else
|
|
|
|
++ fstype,
|
|
|
|
++ src,
|
|
|
|
++ fs->fs_optstr);
|
|
|
|
++#endif
|
|
|
|
+
|
|
|
|
+ if (rc >= 10) {
|
|
|
|
+ fs->flags |= MNT_FS_KERNEL;
|
|
|
|
+@@ -279,14 +320,25 @@
|
|
|
|
+ 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 */
|
|
|
|
+ "%jd" /* (3) size */
|
|
|
|
+ "%jd" /* (4) used */
|
|
|
|
+ "%d", /* priority */
|
|
|
|
+
|
|
|
|
++#ifndef HAVE_SCANF_MS_MODIFIER
|
|
|
|
+ &src,
|
|
|
|
+ &fs->swaptype,
|
|
|
|
++#else
|
|
|
|
++ src,
|
|
|
|
++ fs->swaptype,
|
|
|
|
++#endif
|
|
|
|
+ &fsz,
|
|
|
|
+ &usz,
|
|
|
|
+ &fs->priority);
|