mirror of
https://github.com/samba-team/samba.git
synced 2025-08-26 01:49:31 +03:00
messaging3: Make messaging_dgm_wipe return 0/errno
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
committed by
Jeremy Allison
parent
2f3435085e
commit
9fd8d5154f
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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 */
|
||||
|
Reference in New Issue
Block a user