From: Jule Anger Date: Wed, 23 Mar 2022 14:17:48 +0000 (+0100) Subject: smbstatus: add struct traverse_state X-Git-Tag: samba-4.17.0rc1~45 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=caae58fad825b26578b2068dd9abe7a068affd83;p=thirdparty%2Fsamba.git smbstatus: add struct traverse_state Signed-off-by: Jule Anger Reviewed-by: Ralph Boehme --- diff --git a/source3/utils/status.c b/source3/utils/status.c index ea7797f2705..300cdc0df95 100644 --- a/source3/utils/status.c +++ b/source3/utils/status.c @@ -48,6 +48,7 @@ #include "conn_tdb.h" #include "serverid.h" #include "status_profile.h" +#include "status.h" #include "smbd/notifyd/notifyd_db.h" #include "cmdline_contexts.h" #include "locking/leases_db.h" @@ -618,8 +619,8 @@ int main(int argc, const char *argv[]) int profile_only = 0; bool show_processes, show_locks, show_shares; bool show_notify = false; - bool resolve_uids = false; poptContext pc = NULL; + struct traverse_state state = {0}; struct poptOption long_options[] = { POPT_AUTOHELP { @@ -736,6 +737,8 @@ int main(int argc, const char *argv[]) char *db_path; bool ok; + state.resolve_uids = false; + smb_init_locale(); ok = samba_cmdline_init(frame, @@ -796,7 +799,7 @@ int main(int argc, const char *argv[]) do_checks = false; break; case OPT_RESOLVE_UIDS: - resolve_uids = true; + state.resolve_uids = true; break; case POPT_ERROR_BADOPT: fprintf(stderr, "\nInvalid option %s: %s\n\n", @@ -916,7 +919,7 @@ int main(int argc, const char *argv[]) goto done; } - result = share_entry_forall(print_share_mode, &resolve_uids); + result = share_entry_forall(print_share_mode, &state.resolve_uids); if (result == 0) { fprintf(stderr, "No locked files\n"); diff --git a/source3/utils/status.h b/source3/utils/status.h new file mode 100644 index 00000000000..5855d93dc1f --- /dev/null +++ b/source3/utils/status.h @@ -0,0 +1,27 @@ +/* + * Samba Unix/Linux SMB client library + * State struct + * Copyright (C) Jule Anger 2022 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef STATUS_H +#define STATUS_H + +struct traverse_state { + bool resolve_uids; +}; + +#endif