summaryrefslogtreecommitdiff
path: root/core/util-linux
diff options
context:
space:
mode:
authorroot <root@rshg054.dnsready.net>2013-05-29 01:29:52 -0700
committerroot <root@rshg054.dnsready.net>2013-05-29 01:29:52 -0700
commitd267e861074512027414df29d18d9824e0faae8f (patch)
tree770bb482bb715a84eab76bfbfa1b748d31a13541 /core/util-linux
parent72a09de07cab5e8ad5c3ec7c36814663a3f7a33b (diff)
Wed May 29 01:29:24 PDT 2013
Diffstat (limited to 'core/util-linux')
-rw-r--r--core/util-linux/0001-libfdisk-do-not-use-va_list-in-the-Ask-API.patch163
-rw-r--r--core/util-linux/PKGBUILD7
2 files changed, 168 insertions, 2 deletions
diff --git a/core/util-linux/0001-libfdisk-do-not-use-va_list-in-the-Ask-API.patch b/core/util-linux/0001-libfdisk-do-not-use-va_list-in-the-Ask-API.patch
new file mode 100644
index 000000000..86bb6e572
--- /dev/null
+++ b/core/util-linux/0001-libfdisk-do-not-use-va_list-in-the-Ask-API.patch
@@ -0,0 +1,163 @@
+From 4fb18cde32a6cb672090762c785d89a6ed02ef57 Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak@redhat.com>
+Date: Thu, 9 May 2013 13:06:02 +0200
+Subject: [PATCH] libfdisk: do not use va_list in the Ask API
+
+ # fdisk /dev/sda
+ Welcome to fdisk (util-linux 2.23).
+
+ [...]
+
+ Command (m for help): a
+ Segmentation fault (core dumped)
+
+It's too fragile, the va_list implementation is architecture specific
+and it seems we need such thing in libfdisk at all.
+
+Reported-by: "Gabor Z. Papp" <gzp@papp.hu>
+Signed-off-by: Karel Zak <kzak@redhat.com>
+---
+ fdisks/fdisk-ask.c | 13 +++----------
+ libfdisk/src/ask.c | 35 +++++++++--------------------------
+ libfdisk/src/fdiskP.h | 2 --
+ libfdisk/src/libfdisk.h | 2 --
+ 4 files changed, 12 insertions(+), 40 deletions(-)
+
+diff --git a/fdisks/fdisk-ask.c b/fdisks/fdisk-ask.c
+index 7495d85..61dc0c2 100644
+--- a/fdisks/fdisk-ask.c
++++ b/fdisks/fdisk-ask.c
+@@ -167,7 +167,6 @@ static int ask_offset(struct fdisk_context *cxt,
+ int ask_callback(struct fdisk_context *cxt, struct fdisk_ask *ask,
+ void *data __attribute__((__unused__)))
+ {
+- va_list ap;
+ int rc = 0;
+ char buf[BUFSIZ];
+
+@@ -180,23 +179,17 @@ int ask_callback(struct fdisk_context *cxt, struct fdisk_ask *ask,
+ case FDISK_ASKTYPE_OFFSET:
+ return ask_offset(cxt, ask, buf, sizeof(buf));
+ case FDISK_ASKTYPE_INFO:
+- fdisk_ask_print_get_va(ask, ap);
+- vfprintf(stdout, fdisk_ask_print_get_mesg(ask), ap);
++ fputs(fdisk_ask_print_get_mesg(ask), stdout);
+ fputc('\n', stdout);
+- va_end(ap);
+ break;
+ case FDISK_ASKTYPE_WARNX:
+- fdisk_ask_print_get_va(ask, ap);
+- vfprintf(stderr, fdisk_ask_print_get_mesg(ask), ap);
++ fputs(fdisk_ask_print_get_mesg(ask), stderr);
+ fputc('\n', stderr);
+- va_end(ap);
+ break;
+ case FDISK_ASKTYPE_WARN:
+- fdisk_ask_print_get_va(ask, ap);
+- vfprintf(stderr, fdisk_ask_print_get_mesg(ask), ap);
++ fputs(fdisk_ask_print_get_mesg(ask), stderr);
+ errno = fdisk_ask_print_get_errno(ask);
+ fprintf(stderr, ": %m\n");
+- va_end(ap);
+ break;
+ case FDISK_ASKTYPE_YESNO:
+ fputc('\n', stdout);
+diff --git a/libfdisk/src/ask.c b/libfdisk/src/ask.c
+index d2325d5..cdb4d01 100644
+--- a/libfdisk/src/ask.c
++++ b/libfdisk/src/ask.c
+@@ -18,11 +18,6 @@ void fdisk_reset_ask(struct fdisk_ask *ask)
+ case FDISK_ASKTYPE_NUMBER:
+ free(ask->data.num.range);
+ break;
+- case FDISK_ASKTYPE_WARNX:
+- case FDISK_ASKTYPE_WARN:
+- if (ask->data.print.has_va)
+- va_end(ask->data.print.va);
+- break;
+ default:
+ break;
+ }
+@@ -452,44 +447,32 @@ int fdisk_ask_print_set_mesg(struct fdisk_ask *ask, const char *mesg)
+ return 0;
+ }
+
+-/* caller has to call va_end(ap) */
+-int fdisk_ask_print_get_va(struct fdisk_ask *ask, va_list ap)
+-{
+- assert(ask);
+- assert(is_print_ask(ask));
+- va_copy(ap, ask->data.print.va);
+- return 0;
+-}
+-
+-/* note that fdisk_free_ask() calls va_end() to free the private va list. */
+-int fdisk_ask_print_set_va(struct fdisk_ask *ask, va_list ap)
+-{
+- assert(ask);
+- va_copy(ask->data.print.va, ap);
+- ask->data.print.has_va = 1;
+- return 0;
+-}
+-
+ static int do_vprint(struct fdisk_context *cxt, int errnum, int type,
+ const char *fmt, va_list va)
+ {
+ struct fdisk_ask *ask;
+ int rc;
++ char *mesg;
+
+ assert(cxt);
+
++ if (vasprintf(&mesg, fmt, va) < 0)
++ return -ENOMEM;
++
+ ask = fdisk_new_ask();
+- if (!ask)
++ if (!ask) {
++ free(mesg);
+ return -ENOMEM;
++ }
+
+ fdisk_ask_set_type(ask, type);
+- fdisk_ask_print_set_mesg(ask, fmt);
+- fdisk_ask_print_set_va(ask, va);
++ fdisk_ask_print_set_mesg(ask, mesg);
+ if (errnum >= 0)
+ fdisk_ask_print_set_errno(ask, errnum);
+ rc = fdisk_do_ask(cxt, ask);
+
+ fdisk_free_ask(ask);
++ free(mesg);
+ return rc;
+ }
+
+diff --git a/libfdisk/src/fdiskP.h b/libfdisk/src/fdiskP.h
+index 570108c..ce42860 100644
+--- a/libfdisk/src/fdiskP.h
++++ b/libfdisk/src/fdiskP.h
+@@ -231,8 +231,6 @@ struct fdisk_ask {
+ /* FDISK_ASKTYPE_{WARN,WARNX,..} */
+ struct ask_print {
+ const char *mesg;
+- va_list va;
+- unsigned int has_va:1;
+ int errnum; /* errno */
+ } print;
+ /* FDISK_ASKTYPE_YESNO */
+diff --git a/libfdisk/src/libfdisk.h b/libfdisk/src/libfdisk.h
+index 0a23236..8a44067 100644
+--- a/libfdisk/src/libfdisk.h
++++ b/libfdisk/src/libfdisk.h
+@@ -182,8 +182,6 @@ extern int fdisk_ask_print_get_errno(struct fdisk_ask *ask);
+ extern int fdisk_ask_print_set_errno(struct fdisk_ask *ask, int errnum);
+ extern const char *fdisk_ask_print_get_mesg(struct fdisk_ask *ask);
+ extern int fdisk_ask_print_set_mesg(struct fdisk_ask *ask, const char *mesg);
+-extern int fdisk_ask_print_get_va(struct fdisk_ask *ask, va_list ap);
+-extern int fdisk_ask_print_set_va(struct fdisk_ask *ask, va_list ap);
+
+ #ifdef __cplusplus
+ }
+--
+1.8.2.3
+
diff --git a/core/util-linux/PKGBUILD b/core/util-linux/PKGBUILD
index 77b94f1a8..c5bacea39 100644
--- a/core/util-linux/PKGBUILD
+++ b/core/util-linux/PKGBUILD
@@ -1,10 +1,10 @@
-# $Id: PKGBUILD 185607 2013-05-15 22:53:31Z tomegun $
+# $Id: PKGBUILD 186531 2013-05-28 12:25:50Z dreisner $
# Maintainer: Tom Gundersen <teg@jklm.no>
# Contributor: judd <jvinet@zeroflux.org>
pkgname=util-linux
pkgver=2.23
-pkgrel=2
+pkgrel=3
pkgdesc="Miscellaneous system utilities for Linux"
url="http://www.kernel.org/pub/linux/utils/util-linux/"
arch=('i686' 'x86_64')
@@ -19,6 +19,7 @@ options=('!libtool')
source=("ftp://ftp.kernel.org/pub/linux/utils/$pkgname/v2.23/$pkgname-$pkgver.tar.xz"
0001-lib-loopdev-fix-loopcxt_check_size-to-work-with-blkd.patch
0001-losetup-use-warn_size-for-regular-files-only.patch
+ 0001-libfdisk-do-not-use-va_list-in-the-Ask-API.patch
uuidd.tmpfiles
pam-login
pam-common
@@ -32,6 +33,7 @@ install=util-linux.install
md5sums=('cf5e9bb402371beaaffc3a5f276d5783'
'fdb627fbb3d6a42e0b36978649b4c064'
'de0ba450945a60f27c5df86e64523d57'
+ 'df949d15dbff01fe9fcda5d999a35b15'
'a39554bfd65cccfd8254bb46922f4a67'
'4368b3f98abd8a32662e094c54e7f9b1'
'a31374fef2cba0ca34dfc7078e2969e4'
@@ -42,6 +44,7 @@ prepare() {
patch -Np1 <"$srcdir"/0001-lib-loopdev-fix-loopcxt_check_size-to-work-with-blkd.patch
patch -Np1 <"$srcdir"/0001-losetup-use-warn_size-for-regular-files-only.patch
+ patch -Np1 <"$srcdir"/0001-libfdisk-do-not-use-va_list-in-the-Ask-API.patch
}
build() {