The branch, master has been updated via 98d84192a03 s3:utils:mdsearch go to cmdline_messaging_context_free from de5d31f452b s3:smbstatus: go to cmdline_messaging_context_free
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 98d84192a03a4f1135eaf1590fb62b16d8bc49c8 Author: Jones Syue <joness...@qnap.com> Date: Thu Jan 12 15:47:20 2023 +0800 s3:utils:mdsearch go to cmdline_messaging_context_free mdsearch utility would exit earlier with failure in several cases like: a. samba server is not running yet, [~] # mdsearch -Uuser%password1 ${server} Public '*=="Samba"' main: Cannot connect to server: NT_STATUS_CONNECTION_REFUSED b. spotlight backend service is not ready yet, [~] # mdsearch -Uuser%password1 ${server} Public '*=="Samba"' Failed to connect mdssvc c. mdsearch utility paramters is not as expecred, [~] # mdsearch -Uuser%password1 ${server} share_not_exist '*=="Samba"' mdscli_search failed And in the mean while once mdsearch utility exit earlier with failure, the lock files are left behind in the directory 'msg.sock' and 'msg.lock'. If a script to run mdsearch utility in a loop, this might result in used space slowly growing-up on underlying filesystem. Supposed to add a new label 'fail_free_messaging', make it go through the cmdline_messaging_context_free() which deletes the lock files in the directory msg.sock and msg.lock before mdsearch utility is exiting with failure. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15284 Signed-off-by: Jones Syue <joness...@qnap.com> Reviewed-by: Ralph Boehme <s...@samba.org> Reviewed-by: Volker Lendecke <v...@samba.org> Autobuild-User(master): Volker Lendecke <v...@samba.org> Autobuild-Date(master): Thu Jan 12 11:40:19 UTC 2023 on sn-devel-184 ----------------------------------------------------------------------- Summary of changes: source3/utils/mdsearch.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/utils/mdsearch.c b/source3/utils/mdsearch.c index ab48e366a0a..eddb83874cb 100644 --- a/source3/utils/mdsearch.c +++ b/source3/utils/mdsearch.c @@ -144,12 +144,12 @@ int main(int argc, char **argv) flags); if (!NT_STATUS_IS_OK(status)) { DBG_ERR("Cannot connect to server: %s\n", nt_errstr(status)); - goto fail; + goto fail_free_messaging; } status = cli_rpc_pipe_open_noauth(cli, &ndr_table_mdssvc, &rpccli); if (!NT_STATUS_IS_OK(status)) { - goto fail; + goto fail_free_messaging; } status = mdscli_connect(frame, @@ -159,7 +159,7 @@ int main(int argc, char **argv) &mdscli_ctx); if (!NT_STATUS_IS_OK(status)) { printf("Failed to connect mdssvc\n"); - goto fail; + goto fail_free_messaging; } if (opt_path == NULL) { @@ -168,7 +168,7 @@ int main(int argc, char **argv) basepath = talloc_strdup(frame, opt_path); } if (basepath == NULL) { - goto fail; + goto fail_free_messaging; } status = mdscli_search(frame, @@ -179,7 +179,7 @@ int main(int argc, char **argv) &search); if (!NT_STATUS_IS_OK(status)) { printf("mdscli_search failed\n"); - goto fail; + goto fail_free_messaging; } if (!opt_live) { @@ -199,7 +199,7 @@ int main(int argc, char **argv) } if (!NT_STATUS_IS_OK(status)) { printf("mdscli_get_results failed\n"); - goto fail; + goto fail_free_messaging; } ncnids = talloc_array_length(cnids); @@ -217,7 +217,7 @@ int main(int argc, char **argv) if (!NT_STATUS_IS_OK(status)) { printf("Get path for CNID 0x%"PRIx64" failed\n", cnids[i]); - goto fail; + goto fail_free_messaging; } printf("%s\n", path); TALLOC_FREE(path); @@ -227,13 +227,13 @@ int main(int argc, char **argv) status = mdscli_close_search(&search); if (!NT_STATUS_IS_OK(status)) { printf("mdscli_close_search failed\n"); - goto fail; + goto fail_free_messaging; } status = mdscli_disconnect(mdscli_ctx); if (!NT_STATUS_IS_OK(status)) { printf("mdscli_disconnect failed\n"); - goto fail; + goto fail_free_messaging; } cmdline_messaging_context_free(); @@ -241,6 +241,8 @@ int main(int argc, char **argv) poptFreeContext(pc); return 0; +fail_free_messaging: + cmdline_messaging_context_free(); fail: poptFreeContext(pc); TALLOC_FREE(frame); -- Samba Shared Repository