aboutsummaryrefslogtreecommitdiffstats
path: root/main/util-linux/gentoo-no-scanf.patch
diff options
context:
space:
mode:
authorJeff Pohlmeyer <yetanothergeek@gmail.com>2013-12-04 15:04:53 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2013-12-04 15:04:53 +0000
commit19bf0b70289e8a55e3fb67af46c2f8f986b51040 (patch)
tree31fabbff18b89423a88ea8bfcd83616f31eb497a /main/util-linux/gentoo-no-scanf.patch
parente122fa6adff3c73c91e6e396d438f32bb8251b80 (diff)
downloadaports-19bf0b70289e8a55e3fb67af46c2f8f986b51040.tar.bz2
aports-19bf0b70289e8a55e3fb67af46c2f8f986b51040.tar.xz
main/util-linux: Fix segfault when reading /proc/swaps
Diffstat (limited to 'main/util-linux/gentoo-no-scanf.patch')
-rw-r--r--main/util-linux/gentoo-no-scanf.patch52
1 files changed, 40 insertions, 12 deletions
diff --git a/main/util-linux/gentoo-no-scanf.patch b/main/util-linux/gentoo-no-scanf.patch
index 6818224c92..c95b7553e0 100644
--- a/main/util-linux/gentoo-no-scanf.patch
+++ b/main/util-linux/gentoo-no-scanf.patch
@@ -1,19 +1,21 @@
-for systems that don't support latest POSIX standard: %as
+Fix libmount build under uClibc
-https://bugs.gentoo.org/406303
+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
---- a/configure.ac
-+++ b/configure.ac
-@@ -688,7 +688,6 @@ AC_ARG_ENABLE([libmount],
+--- a/configure.ac 2013-07-30 03:39:26.188738061 -0500
++++ b/configure.ac 2013-09-05 15:31:11.460864363 -0500
+@@ -755,7 +755,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)
- AC_SUBST([LIBMOUNT_VERSION])
---- 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-05 15:31:11.460864363 -0500
@@ -22,6 +22,10 @@
#include "pathnames.h"
#include "strutils.h"
@@ -25,7 +27,7 @@ https://bugs.gentoo.org/406303
static inline char *skip_spaces(char *s)
{
assert(s);
-@@ -61,16 +65,31 @@ static int mnt_parse_table_line(struct libmnt_fs *fs, char *s)
+@@ -61,16 +65,31 @@
int rc, n = 0, xrc;
char *src = NULL, *fstype = NULL, *optstr = NULL;
@@ -57,7 +59,7 @@ https://bugs.gentoo.org/406303
&n);
xrc = rc;
-@@ -136,6 +155,16 @@ static int mnt_parse_mountinfo_line(struct libmnt_fs *fs, char *s)
+@@ -136,6 +155,16 @@
unsigned int maj, min;
char *fstype = NULL, *src = NULL, *p;
@@ -74,7 +76,7 @@ https://bugs.gentoo.org/406303
rc = sscanf(s, "%u " /* (1) id */
"%u " /* (2) parent */
"%u:%u " /* (3) maj:min */
-@@ -147,9 +175,15 @@ static int mnt_parse_mountinfo_line(struct libmnt_fs *fs, char *s)
+@@ -147,9 +176,15 @@
&fs->id,
&fs->parent,
&maj, &min,
@@ -90,7 +92,7 @@ https://bugs.gentoo.org/406303
&end);
if (rc >= 7 && end > 0)
-@@ -167,9 +201,15 @@ static int mnt_parse_mountinfo_line(struct libmnt_fs *fs, char *s)
+@@ -169,9 +204,15 @@
UL_SCNsA" " /* (9) source */
UL_SCNsA, /* (10) fs options (fs specific) */
@@ -106,3 +108,29 @@ https://bugs.gentoo.org/406303
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 */
+
++#ifdef HAVE_SCANF_MS_MODIFIER
+ &src,
+ &fs->swaptype,
++#else
++ src,
++ fs->swaptype,
++#endif
+ &fsz,
+ &usz,
+ &fs->priority);