summaryrefslogtreecommitdiffstats
path: root/src/guestfs.c
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2009-08-03 08:43:54 -0400
committerJim Meyering <meyering@redhat.com>2009-08-03 15:13:37 +0200
commitd0fa2e6b7bccb00dbaae09a4d4c1a87b1dea0351 (patch)
tree1d57d960a6d949e064b4b86354b0f96307475cdf /src/guestfs.c
parent6279c4bbf9cbbe66917ce9ffa4b98eca9040bcd9 (diff)
downloadlibguestfs-d0fa2e6b7bccb00dbaae09a4d4c1a87b1dea0351.tar.gz
libguestfs-d0fa2e6b7bccb00dbaae09a4d4c1a87b1dea0351.tar.xz
libguestfs-d0fa2e6b7bccb00dbaae09a4d4c1a87b1dea0351.zip
guestfs: don't fault upon failed vasprintf
* src/guestfs.c (guestfs_perrorf): Handle failed vasprintf.
Diffstat (limited to 'src/guestfs.c')
-rw-r--r--src/guestfs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/guestfs.c b/src/guestfs.c
index 63e24f0a..802c1d21 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);