]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib;smbd: Fix the -Os build by initializing variables
authorVolker Lendecke <vl@samba.org>
Fri, 23 Jul 2021 06:46:51 +0000 (08:46 +0200)
committerJeremy Allison <jra@samba.org>
Fri, 6 Aug 2021 17:22:30 +0000 (17:22 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
lib/mscat/mscat_ctl.c
source3/lib/sendfile.c
source3/rpc_client/cli_winreg_spoolss.c
source3/smbd/notifyd/notifyd.c
source3/smbd/oplock_linux.c
source4/torture/smb2/dir.c

index 974ace83c309652f49214ade4824f8155982ff62..426ddc571611d71b147d37aafe6c553e731cd5dc 100644 (file)
@@ -990,8 +990,8 @@ static int ctl_get_member_attributes(struct mscat_ctl *ctl,
 
                ok = mscat_asn1_oid_equal(oid, CAT_MEMBERINFO_OBJID);
                if (ok) {
-                       char *name;
-                       uint32_t id;
+                       char *name = NULL;
+                       uint32_t id = 0;
 
                        rc = ctl_parse_member_info(ctl,
                                                   tmp_ctx,
index d3effaf30aa4537d24741c59db3dbc4afefd9839..69c89d29f3190d5fbce52167faa3e093659b70eb 100644 (file)
@@ -136,12 +136,9 @@ ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, off_t offset
   out:
 
        if (socket_flags_changed) {
-               int saved_errno;
+               int saved_errno = errno;
                int err;
 
-               if (ret == -1) {
-                       saved_errno = errno;
-               }
                /* Restore the old state of the socket. */
                err = fcntl(tofd, F_SETFL, old_flags);
                if (err == -1) {
index 8270771c79bff766c4e54a8ad6cfb111304182c0..ca46ae5301255fc45666cc3e41c6f8d550b1151c 100644 (file)
@@ -3699,11 +3699,11 @@ WERROR winreg_get_driver(TALLOC_CTX *mem_ctx,
 {
        uint32_t access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
        struct policy_handle hive_hnd, key_hnd;
-       struct spoolss_DriverInfo8 i8, *info8;
+       struct spoolss_DriverInfo8 i8, *info8 = NULL;
        struct spoolss_PrinterEnumValues *enum_values = NULL;
-       struct spoolss_PrinterEnumValues *v;
+       struct spoolss_PrinterEnumValues *v = NULL;
        uint32_t num_values = 0;
-       TALLOC_CTX *tmp_ctx;
+       TALLOC_CTX *tmp_ctx = NULL;
        WERROR result;
        NTSTATUS status;
        uint32_t i;
@@ -4168,15 +4168,15 @@ WERROR winreg_get_core_driver(TALLOC_CTX *mem_ctx,
 {
        uint32_t access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
        struct policy_handle hive_hnd, key_hnd;
-       struct spoolss_CorePrinterDriver *c;
+       struct spoolss_CorePrinterDriver *c = NULL;
        struct spoolss_PrinterEnumValues *enum_values = NULL;
-       struct spoolss_PrinterEnumValues *v;
+       struct spoolss_PrinterEnumValues *v = NULL;
        uint32_t num_values = 0;
-       TALLOC_CTX *tmp_ctx;
+       TALLOC_CTX *tmp_ctx = NULL;
        WERROR result;
        NTSTATUS status;
-       const char *path;
-       const char *guid_str;
+       const char *path = NULL;
+       const char *guid_str = NULL;
        uint32_t i;
        const char **enum_names = NULL;
        enum winreg_Type *enum_types = NULL;
@@ -4505,12 +4505,12 @@ WERROR winreg_get_driver_package(TALLOC_CTX *mem_ctx,
        uint32_t access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
        struct policy_handle hive_hnd, key_hnd;
        struct spoolss_PrinterEnumValues *enum_values = NULL;
-       struct spoolss_PrinterEnumValues *v;
+       struct spoolss_PrinterEnumValues *v = NULL;
        uint32_t num_values = 0;
-       TALLOC_CTX *tmp_ctx;
+       TALLOC_CTX *tmp_ctx = NULL;
        WERROR result;
        NTSTATUS status;
-       const char *path;
+       const char *path = NULL;
        uint32_t i;
        const char **enum_names = NULL;
        enum winreg_Type *enum_types = NULL;
index 7d925d6c3b7658725b334d00048d82b0c874cc73..475c8e9f508473e72afaf6e11ba6effd44ce2e77 100644 (file)
@@ -336,11 +336,11 @@ static bool notifyd_apply_rec_change(
        struct sys_notify_context *sys_notify_ctx,
        struct messaging_context *msg_ctx)
 {
-       struct db_record *rec;
-       struct notifyd_instance *instances;
+       struct db_record *rec = NULL;
+       struct notifyd_instance *instances = NULL;
        size_t num_instances;
        size_t i;
-       struct notifyd_instance *instance;
+       struct notifyd_instance *instance = NULL;
        TDB_DATA value;
        NTSTATUS status;
        bool ok = false;
index a1571aad46bb871ceec8434c175977ef7c593b6d..4910c57c32256dc60296c36a5988df49aa88238b 100644 (file)
@@ -51,7 +51,7 @@ int linux_set_lease_sighandler(int fd)
 int linux_setlease(int fd, int leasetype)
 {
        int ret;
-       int saved_errno;
+       int saved_errno = 0;
 
        /*
         * Ensure the lease owner is root to allow
index eed70718021bd2ac139891a250f28668b5d40ec1..3bd0f59044f3092cbfa49c7f49e4247bc30d89e0 100644 (file)
@@ -116,7 +116,7 @@ static bool test_find(struct torture_context *tctx,
        NTSTATUS status;
        bool ret = true;
        unsigned int count;
-       int i, j, file_count = 0;
+       int i, j = 0, file_count = 0;
 
        status = populate_tree(tctx, mem_ctx, tree, files, NFILES, &h);
 
@@ -1300,7 +1300,7 @@ static bool test_large_files(struct torture_context *tctx,
        struct smb2_find f;
        struct smb2_handle h = {{0}};
        union smb_search_data *d;
-       int i, j, file_count = 0;
+       int i, j = 0, file_count = 0;
        char **strs = NULL;
        unsigned count;