]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libsmb: Simplify net_share_enum_rpc() with a direct struct initialization
authorVolker Lendecke <vl@samba.org>
Fri, 25 Apr 2025 14:07:20 +0000 (16:07 +0200)
committerVolker Lendecke <vl@samba.org>
Thu, 15 May 2025 14:03:34 +0000 (14:03 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/libsmb/libsmb_dir.c

index 76733066ecf04b8dd4125669088a68062aca747a..2522f8d5bf6000ad25dc44ea9bd9dd62760168aa 100644 (file)
@@ -354,8 +354,11 @@ net_share_enum_rpc(struct cli_state *cli,
        WERROR result;
        uint32_t preferred_len = 0xffffffff;
         uint32_t type;
-       struct srvsvc_NetShareInfoCtr info_ctr;
-       struct srvsvc_NetShareCtr1 ctr1;
+       struct srvsvc_NetShareCtr1 ctr1 = {};
+       struct srvsvc_NetShareInfoCtr info_ctr = {
+               .level = 1,
+               .ctr.ctr1 = &ctr1,
+       };
        fstring name = "";
         fstring comment = "";
        struct rpc_pipe_client *pipe_hnd = NULL;
@@ -372,12 +375,6 @@ net_share_enum_rpc(struct cli_state *cli,
                goto done;
         }
 
-       ZERO_STRUCT(info_ctr);
-       ZERO_STRUCT(ctr1);
-
-       info_ctr.level = 1;
-       info_ctr.ctr.ctr1 = &ctr1;
-
        b = pipe_hnd->binding_handle;
 
         /* Issue the NetShareEnum RPC call and retrieve the response */