kumquat-buildroot/package/util-linux/util-linux-001-sscanf-no-ms-as.patch
Ryan Barnett 66c0d5d05c util-linux: bump version to 2.23
Removed patches that were are now in version 2.23 of util-linux along with
fixed up other patches so they apply cleanly.

Signed-off-by: Ryan Barnett <rjbarnet@rockwellcollins.com>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
2013-09-05 15:45:42 +02:00

139 lines
3.1 KiB
Diff

Fix libmount build under uClibc
See https://bugs.gentoo.org/show_bug.cgi?id=406303
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
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 @@
UL_BUILD_INIT([libmount])
UL_REQUIRES_LINUX([libmount])
UL_REQUIRES_BUILD([libmount], [libblkid])
-UL_REQUIRES_HAVE([libmount], [scanf_alloc_modifier], [scanf string alloc modifier])
AM_CONDITIONAL(BUILD_LIBMOUNT, test "x$build_libmount" = xyes)
AM_CONDITIONAL(BUILD_LIBMOUNT_TESTS, test "x$build_libmount" = xyes -a "x$enable_static" = xyes)
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)
{
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, UL_SCNsA" " /* (1) source */
UL_SCNsA" " /* (2) target */
UL_SCNsA" " /* (3) FS type */
UL_SCNsA" " /* (4) options */
"%n", /* byte count */
+#ifdef HAVE_SCANF_MS_MODIFIER
&src,
&fs->target,
&fstype,
&optstr,
+#else
+ src,
+ fs->target,
+ fstype,
+ optstr,
+#endif
&n);
xrc = rc;
@@ -136,6 +155,16 @@
unsigned int maj, min;
char *fstype = NULL, *src = NULL, *p;
+#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 */
"%u " /* (2) parent */
"%u:%u " /* (3) maj:min */
@@ -147,9 +176,15 @@
&fs->id,
&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);
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,
&src,
&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);