diff options
-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 d826c11d8e..fdfa3d9f2c 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 a9015d05b0..53fff214da 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 1e6e9545e6..999945f8f9 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 d11adc666e..edd2edcb63 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 */ |