From f7c744bbf819b5984cbd3569d35d82a0451996b3 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 12 Mar 2012 15:13:29 +0000 Subject: 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. --- fish/fish.c | 2 ++ fish/fish.h | 2 +- fish/rc.c | 3 ++- 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. */ -- cgit