From 774e791d2617b318223317aa004e495b9d274d97 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)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