summaryrefslogtreecommitdiffstats
path: root/daemon/guestfsd.c
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2010-05-06 20:32:09 +0100
committerRichard Jones <rjones@redhat.com>2010-05-07 15:27:28 +0100
commit34067b5c362d5070e91364cc1ed6487497462b42 (patch)
tree2fb6cfbf8995fa9cb9962659c5d87550c9342c5c /daemon/guestfsd.c
parent4839d5142ca50818965866287932f9ded14729e6 (diff)
downloadlibguestfs-34067b5c362d5070e91364cc1ed6487497462b42.tar.gz
libguestfs-34067b5c362d5070e91364cc1ed6487497462b42.tar.xz
libguestfs-34067b5c362d5070e91364cc1ed6487497462b42.zip
daemon: Change command to abort() on resource problems.
The comment in the code describes it thus: /* Note: abort is used in a few places along the error paths early * in this function. This is because (a) cleaning up correctly is * very complex at these places and (b) abort is used when a * resource problem is indicated which would be due to much more * serious issues - eg. memory or file descriptor leaks. We * wouldn't expect fork(2) or pipe(2) to fail in normal * circumstances. */
Diffstat (limited to 'daemon/guestfsd.c')
-rw-r--r--daemon/guestfsd.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c
index 03a975a7..be793002 100644
--- a/daemon/guestfsd.c
+++ b/daemon/guestfsd.c
@@ -1,5 +1,5 @@
/* libguestfs - the guestfsd daemon
- * Copyright (C) 2009 Red Hat Inc.
+ * Copyright (C) 2009-2010 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -738,19 +738,24 @@ commandrvf (char **stdoutput, char **stderror, int flags,
printf ("\n");
}
+ /* Note: abort is used in a few places along the error paths early
+ * in this function. This is because (a) cleaning up correctly is
+ * very complex at these places and (b) abort is used when a
+ * resource problems is indicated which would be due to much more
+ * serious issues - eg. memory or file descriptor leaks. We
+ * wouldn't expect fork(2) or pipe(2) to fail in normal
+ * circumstances.
+ */
+
if (pipe (so_fd) == -1 || pipe (se_fd) == -1) {
perror ("pipe");
- return -1;
+ abort ();
}
pid = fork ();
if (pid == -1) {
perror ("fork");
- close (so_fd[0]);
- close (so_fd[1]);
- close (se_fd[0]);
- close (se_fd[1]);
- return -1;
+ abort ();
}
if (pid == 0) { /* Child process. */