diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-07-28 05:21:55 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-07-28 05:21:55 +0200 |
commit | 368178c777870459b6e1a0275b94f178bbbafb2d (patch) | |
tree | 2a8d77f7469e9ceae20d4a1ae6461932815c2512 /src/mds-echo.c | |
parent | mds-registry: sync:ing and list action (diff) | |
download | mds-368178c777870459b6e1a0275b94f178bbbafb2d.tar.gz mds-368178c777870459b6e1a0275b94f178bbbafb2d.tar.bz2 mds-368178c777870459b6e1a0275b94f178bbbafb2d.tar.xz |
misc
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/mds-echo.c')
-rw-r--r-- | src/mds-echo.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/mds-echo.c b/src/mds-echo.c index 0f05e25..4295816 100644 --- a/src/mds-echo.c +++ b/src/mds-echo.c @@ -159,6 +159,8 @@ int marshal_server(char* state_buf) buf_set_next(state_buf, int, connected); buf_set_next(state_buf, int32_t, message_id); mds_message_marshal(&received, state_buf); + + mds_message_destroy(&received); return 0; } @@ -206,6 +208,8 @@ int __attribute__((const)) reexec_failure_recover(void) */ int master_loop(void) { + int rc = 1; + while (!reexecing && !terminating) { int r = mds_message_read(&received, socket_fd); @@ -235,15 +239,15 @@ int master_loop(void) connected = 1; } - mds_message_destroy(&received); - free(echo_buffer); - return 0; + rc = 0; + goto fail; pfail: perror(*argv); fail: - mds_message_destroy(&received); + if (rc || !reexecing) + mds_message_destroy(&received); free(echo_buffer); - return 1; + return rc; } |