Jim Meyering
2009-Aug-03 12:44 UTC
[Libguestfs] [PATCH] guestfs: don't fault upon failed vasprintf
>From 774e791d2617b318223317aa004e495b9d274d97 Mon Sep 17 00:00:00 2001From: Jim Meyering <meyering at redhat.com> Date: Mon, 3 Aug 2009 08:43:54 -0400 Subject: [PATCH] guestfs: don't fault upon failed vasprintf * src/guestfs.c (guestfs_perrorf): Handle failed vasprintf. --- src/guestfs.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/src/guestfs.c b/src/guestfs.c index 63e24f0..802c1d2 100644 --- a/src/guestfs.c +++ b/src/guestfs.c @@ -443,9 +443,11 @@ guestfs_perrorf (guestfs_h *g, const char *fs, ...) int err = errno; va_start (args, fs); - vasprintf (&msg, fs, args); + int err = vasprintf (&msg, fs, args); va_end (args); + if (err < 0) return; + #ifndef _GNU_SOURCE char buf[256]; strerror_r (err, buf, sizeof buf); -- 1.6.3.3
Seemingly Similar Threads
- [PATCH] guestfs: fix typo in my recent change
- [patch] fix schnorr vasprintf warnings on openssh-SNAP-20130304
- [PATCH] off-by-one in asprintf/vasprintf
- [klibc:master] Make asprintf() a simple wrapper around vasprintf()
- [Bug 1770] New: circular dependencies prevent building on platforms without strlcpy, vasprintf