summaryrefslogtreecommitdiffstats
path: root/package/util-linux/util-linux-001-sscanf-no-ms-as.patch
diff options
context:
space:
mode:
Diffstat (limited to 'package/util-linux/util-linux-001-sscanf-no-ms-as.patch')
-rw-r--r--package/util-linux/util-linux-001-sscanf-no-ms-as.patch75
1 files changed, 51 insertions, 24 deletions
diff --git a/package/util-linux/util-linux-001-sscanf-no-ms-as.patch b/package/util-linux/util-linux-001-sscanf-no-ms-as.patch
index 5b0ac3646..6ba7bab51 100644
--- a/package/util-linux/util-linux-001-sscanf-no-ms-as.patch
+++ b/package/util-linux/util-linux-001-sscanf-no-ms-as.patch
@@ -1,29 +1,39 @@
-[PATCH] Fix libmount build under uClibc
+Fix libmount build under uClibc
-Taken from gentoo-hardened:
-http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-dev.git;a=commit;h=91879751
+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
-For details, see https://bugs.gentoo.org/show_bug.cgi?id=406303
+Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
-Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
-diff -Naur util-linux-2.20.1.orig/libmount/src/tab_parse.c util-linux-2.20.1/libmount/src/tab_parse.c
---- util-linux-2.20.1.orig/libmount/src/tab_parse.c 2011-12-12 20:51:06.646614964 -0500
-+++ util-linux-2.20.1/libmount/src/tab_parse.c 2011-12-12 21:02:03.587865010 -0500
-@@ -51,19 +51,21 @@
+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
+@@ -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 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)
{
-- int rc, n = 0;
-- char *src, *fstype, *optstr;
+- 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;
++ 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);
++ char *fstype = malloc (sizeof *fstype * len);
++ char *optstr = malloc (sizeof *optstr * len);
+
+ rc = sscanf(s, "%s"" " /* (1) source */
+ "%s"" " /* (2) target */
@@ -40,20 +50,20 @@ diff -Naur util-linux-2.20.1.orig/libmount/src/tab_parse.c util-linux-2.20.1/lib
+ fstype,
+ optstr,
&n);
+ xrc = rc;
- if (rc == 4) {
-@@ -108,16 +110,20 @@
+@@ -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;
unsigned int maj, min;
- char *fstype, *src, *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);
++ fs->root = malloc (sizeof *fs->root * len);
++ fs->target = malloc (sizeof *fs->target * len);
++ fs->vfs_optstr = malloc (sizeof *fs->vfs_optstr * len);
+
rc = sscanf(s, "%u " /* (1) id */
"%u " /* (2) parent */
@@ -67,17 +77,17 @@ diff -Naur util-linux-2.20.1.orig/libmount/src/tab_parse.c util-linux-2.20.1/lib
"%n", /* number of read bytes */
&fs->id,
-@@ -139,9 +145,14 @@
+@@ -163,9 +169,14 @@
}
s = p + 3;
- rc += sscanf(s, UL_SCNsA" " /* (8) FS type */
- UL_SCNsA" " /* (9) source */
- UL_SCNsA, /* (10) fs options (fs specific) */
-+ len = strlen (s) + 1;
++ len = strlen (s) + 1;
+ fstype = malloc (sizeof *fstype * len);
-+ src = malloc (sizeof *src * len);
-+ fs->fs_optstr = malloc (sizeof *fs->fs_optstr * 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 */
@@ -85,3 +95,20 @@ diff -Naur util-linux-2.20.1.orig/libmount/src/tab_parse.c util-linux-2.20.1/lib
&fstype,
&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 */