summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-03-12 15:13:29 +0000
committerRichard W.M. Jones <rjones@redhat.com>2012-03-12 15:13:29 +0000
commitf7c744bbf819b5984cbd3569d35d82a0451996b3 (patch)
treeb7a2dbbb7f8be87853c87de5e1fc716ea00a9115
parentb3a9e818686c83caeb5b4fd9763437eac0d32654 (diff)
downloadlibguestfs-f7c744bbf819b5984cbd3569d35d82a0451996b3.tar.gz
libguestfs-f7c744bbf819b5984cbd3569d35d82a0451996b3.tar.xz
libguestfs-f7c744bbf819b5984cbd3569d35d82a0451996b3.zip
fish: remote: Make sure global cleanups are called for guestfish --listen.
Return to the main program ('fish.c') and perform global cleanups when the guestfish remote server exits.
-rw-r--r--fish/fish.c2
-rw-r--r--fish/fish.h2
-rw-r--r--fish/rc.c3
3 files changed, 5 insertions, 2 deletions
diff --git a/fish/fish.c b/fish/fish.c
index 575fe99d..ac16df5d 100644
--- a/fish/fish.c
+++ b/fish/fish.c
@@ -495,6 +495,7 @@ main (int argc, char *argv[])
exit (EXIT_FAILURE);
}
rc_listen ();
+ goto out;
}
/* -f (file) parameter? */
@@ -545,6 +546,7 @@ main (int argc, char *argv[])
else
cmdline (argv, optind, argc);
+ out:
cleanup_readline ();
if (progress_bars)
diff --git a/fish/fish.h b/fish/fish.h
index d25fd356..668202d7 100644
--- a/fish/fish.h
+++ b/fish/fish.h
@@ -130,7 +130,7 @@ extern void free_prep_data (void *data);
extern int vg_lv_parse (const char *device, char **vg, char **lv);
/* in rc.c (remote control) */
-extern void rc_listen (void) __attribute__((noreturn));
+extern void rc_listen (void);
extern int rc_remote (int pid, const char *cmd, size_t argc, char *argv[],
int exit_on_error);
diff --git a/fish/rc.c b/fish/rc.c
index 2844e8c3..aa12820a 100644
--- a/fish/rc.c
+++ b/fish/rc.c
@@ -310,7 +310,8 @@ rc_listen (void)
}
unlink (sockpath);
- exit (EXIT_SUCCESS);
+
+ /* This returns to 'fish.c', where it jumps to global cleanups and exits. */
}
/* Remote control client. */