diff options
author | Volker Lendecke <vl@samba.org> | 2014-06-04 14:47:05 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2014-06-18 18:51:13 +0200 |
commit | 9fd8d5154f178208f82777f7f81682be66e79400 (patch) | |
tree | 775f42a9df3a6b018f76219025124258156a116d /source3 | |
parent | 2f3435085e0d6f64cd41b2d42e446da8821abc4b (diff) | |
download | samba-9fd8d5154f178208f82777f7f81682be66e79400.tar.gz |
messaging3: Make messaging_dgm_wipe return 0/errno
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/messages.h | 2 | ||||
-rw-r--r-- | source3/lib/messages.c | 7 | ||||
-rw-r--r-- | source3/lib/messages_dgm.c | 13 | ||||
-rw-r--r-- | source3/utils/smbcontrol.c | 12 |
4 files changed, 17 insertions, 17 deletions
diff --git a/source3/include/messages.h b/source3/include/messages.h index d826c11d8e9..fdfa3d9f2ca 100644 --- a/source3/include/messages.h +++ b/source3/include/messages.h @@ -77,7 +77,7 @@ NTSTATUS messaging_dgm_init(struct messaging_context *msg_ctx, TALLOC_CTX *mem_ctx, struct messaging_backend **presult); int messaging_dgm_cleanup(struct messaging_context *msg_ctx, pid_t pid); -NTSTATUS messaging_dgm_wipe(struct messaging_context *msg_ctx); +int messaging_dgm_wipe(struct messaging_context *msg_ctx); void *messaging_dgm_register_tevent_context(TALLOC_CTX *mem_ctx, struct messaging_context *msg_ctx, struct tevent_context *ev); diff --git a/source3/lib/messages.c b/source3/lib/messages.c index a9015d05b06..53fff214dac 100644 --- a/source3/lib/messages.c +++ b/source3/lib/messages.c @@ -879,10 +879,11 @@ static int mess_parent_dgm_cleanup(void *private_data) { struct messaging_context *msg_ctx = talloc_get_type_abort( private_data, struct messaging_context); - NTSTATUS status; + int ret; - status = messaging_dgm_wipe(msg_ctx); - DEBUG(10, ("messaging_dgm_wipe returned %s\n", nt_errstr(status))); + ret = messaging_dgm_wipe(msg_ctx); + DEBUG(10, ("messaging_dgm_wipe returned %s\n", + ret ? strerror(ret) : "ok")); return lp_parm_int(-1, "messaging", "messaging dgm cleanup interval", 60*15); } diff --git a/source3/lib/messages_dgm.c b/source3/lib/messages_dgm.c index 1e6e9545e6d..999945f8f99 100644 --- a/source3/lib/messages_dgm.c +++ b/source3/lib/messages_dgm.c @@ -420,7 +420,7 @@ int messaging_dgm_cleanup(struct messaging_context *msg_ctx, pid_t pid) return 0; } -NTSTATUS messaging_dgm_wipe(struct messaging_context *msg_ctx) +int messaging_dgm_wipe(struct messaging_context *msg_ctx) { struct messaging_backend *be = messaging_local_backend(msg_ctx); struct messaging_dgm_context *ctx = talloc_get_type_abort( @@ -429,6 +429,7 @@ NTSTATUS messaging_dgm_wipe(struct messaging_context *msg_ctx) DIR *msgdir; struct dirent *dp; pid_t our_pid = getpid(); + int ret; /* * We scan the socket directory and not the lock directory. Otherwise @@ -438,14 +439,16 @@ NTSTATUS messaging_dgm_wipe(struct messaging_context *msg_ctx) msgdir_name = talloc_asprintf(talloc_tos(), "%s/msg", ctx->cache_dir); if (msgdir_name == NULL) { - return NT_STATUS_NO_MEMORY; + return ENOMEM; } msgdir = opendir(msgdir_name); - TALLOC_FREE(msgdir_name); if (msgdir == NULL) { - return map_nt_error_from_unix(errno); + ret = errno; + TALLOC_FREE(msgdir_name); + return ret; } + TALLOC_FREE(msgdir_name); while ((dp = readdir(msgdir)) != NULL) { unsigned long pid; @@ -471,7 +474,7 @@ NTSTATUS messaging_dgm_wipe(struct messaging_context *msg_ctx) } closedir(msgdir); - return NT_STATUS_OK; + return 0; } void *messaging_dgm_register_tevent_context(TALLOC_CTX *mem_ctx, diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c index d11adc666e5..edd2edcb63f 100644 --- a/source3/utils/smbcontrol.c +++ b/source3/utils/smbcontrol.c @@ -973,22 +973,18 @@ static bool do_dgm_cleanup(struct tevent_context *ev_ctx, const struct server_id pid, const int argc, const char **argv) { - NTSTATUS status = NT_STATUS_OK; + int ret; if (pid.pid != 0) { - int ret; ret = messaging_dgm_cleanup(msg_ctx, pid.pid); - if (ret != 0) { - status = map_nt_error_from_unix(ret); - } } else { - status = messaging_dgm_wipe(msg_ctx); + ret = messaging_dgm_wipe(msg_ctx); } printf("cleanup(%u) returned %s\n", (unsigned)pid.pid, - nt_errstr(status)); + ret ? strerror(ret) : "ok"); - return NT_STATUS_IS_OK(status); + return (ret == 0); } /* Shutdown a server process */ |