diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-12-09 13:15:10 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-12-09 13:15:10 +0100 |
commit | 7a994c9631c590d6a73c842fa5d2d3567b4771dd (patch) | |
tree | 228ade01f99ba217151a0ed20f29c5f3a5028619 /src/mds-server/reexec.c | |
parent | mds-kbdc: compile-layout: macro_call: fix bug: do not duplicate the arguments if there are none (diff) | |
parent | report an error, rather than causing failure the caller but not for the called function (diff) | |
download | mds-7a994c9631c590d6a73c842fa5d2d3567b4771dd.tar.gz mds-7a994c9631c590d6a73c842fa5d2d3567b4771dd.tar.bz2 mds-7a994c9631c590d6a73c842fa5d2d3567b4771dd.tar.xz |
merge track-errors and resolve conflict
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/mds-server/reexec.c')
-rw-r--r-- | src/mds-server/reexec.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/src/mds-server/reexec.c b/src/mds-server/reexec.c index 981569e..fe8c196 100644 --- a/src/mds-server/reexec.c +++ b/src/mds-server/reexec.c @@ -179,15 +179,13 @@ int unmarshal_server(char* state_buf) ssize_t node; pthread_t slave_thread; - +#define fail soft_fail + /* Create memory address remapping table. */ - if (hash_table_create(&unmarshal_remap_map)) - { - xperror(*argv); - hash_table_destroy(&unmarshal_remap_map, NULL, NULL); - return -1; - } - + fail_if (hash_table_create(&unmarshal_remap_map)); + +#undef fail +#define fail clients_fail /* Get the marshal protocal version. Not needed, there is only the one version right now. */ /* buf_get(state_buf, int, 0, MDS_SERVER_VARS_VERSION); */ @@ -210,20 +208,16 @@ int unmarshal_server(char* state_buf) client_t* value; /* Allocate the client's information. */ - if (xmalloc(value, 1, client_t)) - goto clients_fail; + fail_if (xmalloc(value, 1, client_t)); /* Unmarshal the address, it is used the the client list and the client map, that are also marshalled. */ buf_get_next(state_buf, size_t, value_address); /* Unmarshal the client information. */ - n = client_unmarshal(value, state_buf); - if (n == 0) - goto clients_fail; + fail_if (n = client_unmarshal(value, state_buf), n == 0); /* Populate the remapping table. */ if (hash_table_put(&unmarshal_remap_map, value_address, (size_t)(void*)value) == 0) - if (errno) - goto clients_fail; + fail_if (errno); /* Delayed seeking. */ state_buf += n / sizeof(char); @@ -247,14 +241,15 @@ int unmarshal_server(char* state_buf) break; } +#undef fail +#define fail critical_fail + /* Unmarshal the client list. */ - if (linked_list_unmarshal(&client_list, state_buf)) - goto critical_fail; + fail_if (linked_list_unmarshal(&client_list, state_buf)); state_buf += list_size / sizeof(char); /* Unmarshal the client map. */ - if (fd_table_unmarshal(&client_map, state_buf, unmarshal_remapper)) - goto critical_fail; + fail_if (fd_table_unmarshal(&client_map, state_buf, unmarshal_remapper)); /* Remove non-found elements from the fd table. */ #define __bit(I, _OP_) client_map.used[I / 64] _OP_ ((uint64_t)1 << (I % 64)) @@ -291,8 +286,12 @@ int unmarshal_server(char* state_buf) hash_table_destroy(&unmarshal_remap_map, NULL, NULL); return with_error; +#undef fail - + soft_fail: + xperror(*argv); + hash_table_destroy(&unmarshal_remap_map, NULL, NULL); + return -1; critical_fail: xperror(*argv); abort(); |