From b7286b7e9f78926c252098805d5c5c3d4dfe0ee7 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sat, 10 Dec 2005 09:41:18 +0000 Subject: [PATCH] Fixed bugs with /upgrade command (FIFO pipe now closed before upgrade, and WeeChat log file descriptor closed too) --- src/common/command.c | 12 ++++++++++-- src/common/weechat.h | 1 + weechat/src/common/command.c | 12 ++++++++++-- weechat/src/common/weechat.h | 1 + 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/common/command.c b/src/common/command.c index 0e29f676f..50dc1349b 100644 --- a/src/common/command.c +++ b/src/common/command.c @@ -33,6 +33,7 @@ #include "weelist.h" #include "weeconfig.h" #include "session.h" +#include "fifo.h" #include "../irc/irc.h" #include "../gui/gui.h" #include "../plugins/plugins.h" @@ -2865,6 +2866,13 @@ weechat_cmd_upgrade (int argc, char **argv) #endif (void) config_write (NULL); gui_end (); + fifo_remove (); + if (weechat_log_file) + fclose (weechat_log_file); +#ifdef HAVE_GNUTLS + gnutls_certificate_free_credentials (gnutls_xcred); + gnutls_global_deinit(); +#endif execvp (exec_args[0], exec_args); @@ -2876,12 +2884,12 @@ weechat_cmd_upgrade (int argc, char **argv) fprintf (stderr, _("%s exec failed (program: \"%s\"), exiting WeeChat\n"), WEECHAT_ERROR, exec_args[0]); - + free (exec_args[0]); free (exec_args[3]); free (filename); - weechat_shutdown (EXIT_FAILURE, 0); + exit (EXIT_FAILURE); /* never executed */ return -1; diff --git a/src/common/weechat.h b/src/common/weechat.h index e5847fcd5..379ab80da 100644 --- a/src/common/weechat.h +++ b/src/common/weechat.h @@ -98,6 +98,7 @@ extern char *weechat_argv0; extern time_t weechat_start_time; extern int quit_weechat; extern char *weechat_home; +extern FILE *weechat_log_file; extern char *local_charset; #ifdef HAVE_GNUTLS diff --git a/weechat/src/common/command.c b/weechat/src/common/command.c index 0e29f676f..50dc1349b 100644 --- a/weechat/src/common/command.c +++ b/weechat/src/common/command.c @@ -33,6 +33,7 @@ #include "weelist.h" #include "weeconfig.h" #include "session.h" +#include "fifo.h" #include "../irc/irc.h" #include "../gui/gui.h" #include "../plugins/plugins.h" @@ -2865,6 +2866,13 @@ weechat_cmd_upgrade (int argc, char **argv) #endif (void) config_write (NULL); gui_end (); + fifo_remove (); + if (weechat_log_file) + fclose (weechat_log_file); +#ifdef HAVE_GNUTLS + gnutls_certificate_free_credentials (gnutls_xcred); + gnutls_global_deinit(); +#endif execvp (exec_args[0], exec_args); @@ -2876,12 +2884,12 @@ weechat_cmd_upgrade (int argc, char **argv) fprintf (stderr, _("%s exec failed (program: \"%s\"), exiting WeeChat\n"), WEECHAT_ERROR, exec_args[0]); - + free (exec_args[0]); free (exec_args[3]); free (filename); - weechat_shutdown (EXIT_FAILURE, 0); + exit (EXIT_FAILURE); /* never executed */ return -1; diff --git a/weechat/src/common/weechat.h b/weechat/src/common/weechat.h index e5847fcd5..379ab80da 100644 --- a/weechat/src/common/weechat.h +++ b/weechat/src/common/weechat.h @@ -98,6 +98,7 @@ extern char *weechat_argv0; extern time_t weechat_start_time; extern int quit_weechat; extern char *weechat_home; +extern FILE *weechat_log_file; extern char *local_charset; #ifdef HAVE_GNUTLS