Fix a bunch of "warning: variable ‘XXXX’ set but not used [-Wunused-but-set-variable...
authorJeremy Allison <jra@samba.org>
Mon, 21 Nov 2011 21:06:00 +0000 (13:06 -0800)
committerJeremy Allison <jra@samba.org>
Mon, 21 Nov 2011 22:39:08 +0000 (23:39 +0100)
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Mon Nov 21 23:39:08 CET 2011 on sn-devel-104

13 files changed:
auth/credentials/credentials_krb5.c
auth/credentials/credentials_secrets.c
lib/tdb/tools/tdbtool.c
lib/util/util_runcmd.c
source4/torture/basic/base.c
source4/torture/basic/delaywrite.c
source4/torture/basic/delete.c
source4/torture/basic/disconnect.c
source4/torture/raw/chkpath.c
source4/torture/raw/lock.c
source4/torture/raw/notify.c
source4/torture/raw/oplock.c
source4/torture/raw/unlink.c

index 7130e4164d1514096896285fdfdd139c0cd100e4..1b7be3f63cbe3fcb4e3751e6c85d6cc6f1188922 100644 (file)
@@ -432,8 +432,8 @@ _PUBLIC_ void cli_credentials_invalidate_ccache(struct cli_credentials *cred,
 
 static int free_gssapi_creds(struct gssapi_creds_container *gcc)
 {
-       OM_uint32 min_stat, maj_stat;
-       maj_stat = gss_release_cred(&min_stat, &gcc->creds);
+       OM_uint32 min_stat;
+       (void)gss_release_cred(&min_stat, &gcc->creds);
        return 0;
 }
 
index d86032a5648ed86a464efbb6aad787896fe6af57..bc08d9da9a60e77bf2c126cb33d34053beef372d 100644 (file)
@@ -55,7 +55,6 @@ _PUBLIC_ NTSTATUS cli_credentials_set_secrets(struct cli_credentials *cred,
        
        const char *machine_account;
        const char *password;
-       const char *old_password;
        const char *domain;
        const char *realm;
        enum netr_SchannelType sct;
@@ -99,7 +98,6 @@ _PUBLIC_ NTSTATUS cli_credentials_set_secrets(struct cli_credentials *cred,
        }
 
        password = ldb_msg_find_attr_as_string(msg, "secret", NULL);
-       old_password = ldb_msg_find_attr_as_string(msg, "priorSecret", NULL);
 
        machine_account = ldb_msg_find_attr_as_string(msg, "samAccountName", NULL);
 
index 99d4841cf39d994935401a4b8fc139a5f28acecb..d4b85dcdb13c78cf2bb6a4ae7432ad14ed03f6a8 100644 (file)
@@ -448,11 +448,9 @@ static void speed_tdb(const char *tlimit)
        _start_timer();
        do {
                long int r = random();
-               TDB_DATA key, dbuf;
+               TDB_DATA key;
                key.dptr = discard_const_p(uint8_t, str);
                key.dsize = strlen((char *)key.dptr);
-               dbuf.dptr = (uint8_t *) &r;
-               dbuf.dsize = sizeof(r);
                tdb_fetch(tdb, key);
                t = _end_timer();
                ops++;
index d617254432365d23354885e278734841ff06cd03..cfe0034a32f240fd36aa5cb1b1aea6990476d883 100644 (file)
@@ -74,7 +74,6 @@ struct tevent_req *samba_runcmd_send(TALLOC_CTX *mem_ctx,
        struct samba_runcmd_state *state;
        int p1[2], p2[2];
        char **argv;
-       int ret;
        va_list ap;
 
        req = tevent_req_create(mem_ctx, &state,
@@ -187,7 +186,7 @@ struct tevent_req *samba_runcmd_send(TALLOC_CTX *mem_ctx,
        }
        va_end(ap);
 
-       ret = execvp(state->arg0, argv);
+       (void)execvp(state->arg0, argv);
        fprintf(stderr, "Failed to exec child - %s\n", strerror(errno));
        _exit(255);
        return NULL;
index 10dc892333df6d419eece41333363ef1d545841e..cd0f61b681deed86bd01b46710e588366b11fa70 100644 (file)
@@ -719,7 +719,6 @@ static bool run_vuidtest(struct torture_context *tctx,
        size_t size;
        time_t c_time, a_time, m_time;
 
-       uint16_t orig_vuid;
        NTSTATUS result;
 
        smbcli_unlink(cli->tree, fname);
@@ -727,8 +726,6 @@ static bool run_vuidtest(struct torture_context *tctx,
        fnum = smbcli_open(cli->tree, fname, 
                        O_RDWR | O_CREAT | O_TRUNC, DENY_NONE);
 
-       orig_vuid = cli->session->vuid;
-
        cli->session->vuid += 1234;
 
        torture_comment(tctx, "Testing qfileinfo with wrong vuid\n");
index 8a1dc1ba9de072d5452d1ea6b75e698d0902a549..939827ec3ca20f20aabffb2ab3b7618eee99a2b2 100644 (file)
@@ -1496,8 +1496,8 @@ static bool test_delayed_write_update3(struct torture_context *tctx,
                                       struct smbcli_state *cli,
                                       struct smbcli_state *cli2)
 {
-       union smb_fileinfo finfo0, finfo1, finfo2, finfo3, finfo4;
-       union smb_fileinfo pinfo0, pinfo1, pinfo2, pinfo3, pinfo4, pinfo5;
+       union smb_fileinfo finfo0, finfo1, finfo2, finfo3;
+       union smb_fileinfo pinfo0, pinfo1, pinfo2, pinfo3, pinfo4;
        const char *fname = BASEDIR "\\torture_file3.txt";
        int fnum1 = -1;
        bool ret = true;
@@ -1528,14 +1528,12 @@ static bool test_delayed_write_update3(struct torture_context *tctx,
        finfo1 = finfo0;
        finfo2 = finfo0;
        finfo3 = finfo0;
-       finfo4 = finfo0;
        pinfo0.basic_info.level = RAW_FILEINFO_BASIC_INFO;
        pinfo0.basic_info.in.file.path = fname;
        pinfo1 = pinfo0;
        pinfo2 = pinfo0;
        pinfo3 = pinfo0;
        pinfo4 = pinfo0;
-       pinfo5 = pinfo0;
 
        /* get the initial times */
        GET_INFO_BOTH(finfo0,pinfo0);
@@ -1651,8 +1649,8 @@ static bool test_delayed_write_update3a(struct torture_context *tctx,
                                        struct smbcli_state *cli,
                                        struct smbcli_state *cli2)
 {
-       union smb_fileinfo finfo0, finfo1, finfo2, finfo3, finfo4;
-       union smb_fileinfo pinfo0, pinfo1, pinfo2, pinfo3, pinfo4, pinfo5;
+       union smb_fileinfo finfo0, finfo1, finfo2, finfo3;
+       union smb_fileinfo pinfo0, pinfo1, pinfo2, pinfo3, pinfo4;
        const char *fname = BASEDIR "\\torture_file3a.txt";
        int fnum1 = -1;
        bool ret = true;
@@ -1684,14 +1682,12 @@ static bool test_delayed_write_update3a(struct torture_context *tctx,
        finfo1 = finfo0;
        finfo2 = finfo0;
        finfo3 = finfo0;
-       finfo4 = finfo0;
        pinfo0.basic_info.level = RAW_FILEINFO_BASIC_INFO;
        pinfo0.basic_info.in.file.path = fname;
        pinfo1 = pinfo0;
        pinfo2 = pinfo0;
        pinfo3 = pinfo0;
        pinfo4 = pinfo0;
-       pinfo5 = pinfo0;
 
        /* get the initial times */
        GET_INFO_BOTH(finfo0,pinfo0);
@@ -1867,8 +1863,8 @@ static bool test_delayed_write_update3b(struct torture_context *tctx,
                                        struct smbcli_state *cli,
                                        struct smbcli_state *cli2)
 {
-       union smb_fileinfo finfo0, finfo1, finfo2, finfo3, finfo4;
-       union smb_fileinfo pinfo0, pinfo1, pinfo2, pinfo3, pinfo4, pinfo5;
+       union smb_fileinfo finfo0, finfo1, finfo2, finfo3;
+       union smb_fileinfo pinfo0, pinfo1, pinfo2, pinfo3, pinfo4;
        const char *fname = BASEDIR "\\torture_file3b.txt";
        int fnum1 = -1;
        bool ret = true;
@@ -1899,14 +1895,12 @@ static bool test_delayed_write_update3b(struct torture_context *tctx,
        finfo1 = finfo0;
        finfo2 = finfo0;
        finfo3 = finfo0;
-       finfo4 = finfo0;
        pinfo0.basic_info.level = RAW_FILEINFO_BASIC_INFO;
        pinfo0.basic_info.in.file.path = fname;
        pinfo1 = pinfo0;
        pinfo2 = pinfo0;
        pinfo3 = pinfo0;
        pinfo4 = pinfo0;
-       pinfo5 = pinfo0;
 
        /* get the initial times */
        GET_INFO_BOTH(finfo0,pinfo0);
@@ -2245,8 +2239,8 @@ static bool test_delayed_write_update4(struct torture_context *tctx,
                                       struct smbcli_state *cli,
                                       struct smbcli_state *cli2)
 {
-       union smb_fileinfo finfo0, finfo1, finfo2, finfo3, finfo4;
-       union smb_fileinfo pinfo0, pinfo1, pinfo2, pinfo3, pinfo4, pinfo5;
+       union smb_fileinfo finfo0, finfo1, finfo2, finfo3;
+       union smb_fileinfo pinfo0, pinfo1, pinfo2, pinfo3, pinfo4;
        const char *fname = BASEDIR "\\torture_file4.txt";
        int fnum1 = -1;
        bool ret = true;
@@ -2277,14 +2271,12 @@ static bool test_delayed_write_update4(struct torture_context *tctx,
        finfo1 = finfo0;
        finfo2 = finfo0;
        finfo3 = finfo0;
-       finfo4 = finfo0;
        pinfo0.basic_info.level = RAW_FILEINFO_BASIC_INFO;
        pinfo0.basic_info.in.file.path = fname;
        pinfo1 = pinfo0;
        pinfo2 = pinfo0;
        pinfo3 = pinfo0;
        pinfo4 = pinfo0;
-       pinfo5 = pinfo0;
 
        /* get the initial times */
        GET_INFO_BOTH(finfo0,pinfo0);
index deeeec8057fa0f25000eff31600635625838843d..be538d0e9dda976106cc8821d80bb9c0408784bf 100644 (file)
@@ -1530,7 +1530,6 @@ static bool deltest23(struct torture_context *tctx,
        int dnum1 = -1;
        int dnum2 = -1;
        bool correct = true;
-       NTSTATUS status;
 
        del_clean_area(cli1, cli2);
 
@@ -1556,7 +1555,7 @@ static bool deltest23(struct torture_context *tctx,
            __location__);
 
        /* Set delete on close */
-       status = smbcli_nt_delete_on_close(cli1->tree, dnum1, true);
+       (void)smbcli_nt_delete_on_close(cli1->tree, dnum1, true);
 
        /* Attempt opening the directory again.  It should fail. */
        dnum2 = smbcli_nt_create_full(cli1->tree, dname, 0,
index 71471c7f0a7c078aca829c13769f1f999e11f8c8..17fbc61d2f8c8e0719d86ca2499ae357dd864bb5 100644 (file)
@@ -43,8 +43,8 @@
 static bool test_disconnect_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 {
        union smb_open io;
-       NTSTATUS status;
        struct smbcli_request *req1, *req2;
+       NTSTATUS status;
 
        printf("trying open/disconnect\n");
 
@@ -66,6 +66,11 @@ static bool test_disconnect_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
        io.ntcreatex.in.share_access = 0;
        req1 = smb_raw_open_send(cli->tree, &io);
        req2 = smb_raw_open_send(cli->tree, &io);
+       if (!req1 || !req2) {
+               printf("test_disconnect_open: smb_raw_open_send() "
+                       "returned NULL\n");
+               return false;
+       }
 
        status = smbcli_chkpath(cli->tree, "\\");
        CHECK_STATUS(status, NT_STATUS_OK);
@@ -113,6 +118,11 @@ static bool test_disconnect_lock(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
        lock[0].pid = 2;
        io.lockx.in.timeout = 3000;
        req = smb_raw_lock_send(cli->tree, &io);
+       if (!req) {
+               printf("test_disconnect_lock: smb_raw_lock_send() "
+                       "returned NULL\n");
+               return false;
+       }
 
        status = smbcli_chkpath(cli->tree, "\\");
        CHECK_STATUS(status, NT_STATUS_OK);
index d000283685df3888827e73c1c54925ec40ff4961..ed7b5b2917efc8ed9bde2436139d5474e74c3c67 100644 (file)
@@ -122,7 +122,6 @@ static bool test_chkpath(struct smbcli_state *cli, struct torture_context *tctx)
        NTSTATUS status;
        bool ret = true;
        int fnum = -1;
-       int fnum1 = -1;
 
        io.chkpath.in.path = BASEDIR;
 
@@ -186,7 +185,7 @@ static bool test_chkpath(struct smbcli_state *cli, struct torture_context *tctx)
        /* We expect this open to fail with the same error code as the chkpath below. */
        printf("Testing Open on %s\n", "\\.\\\\\\\\\\\\.");
        /* findfirst seems to fail with a different error. */
-       fnum1 = smbcli_nt_create_full(cli->tree, "\\.\\\\\\\\\\\\.",
+       (void)smbcli_nt_create_full(cli->tree, "\\.\\\\\\\\\\\\.",
                                      0, SEC_RIGHTS_FILE_ALL,
                                      FILE_ATTRIBUTE_NORMAL,
                                      NTCREATEX_SHARE_ACCESS_DELETE|
@@ -227,7 +226,7 @@ static bool test_chkpath(struct smbcli_state *cli, struct torture_context *tctx)
        /* We expect this open to fail with the same error code as the chkpath below. */
        printf("Testing Open on %s\n", BASEDIR".\\.\\.\\.\\foo\\..\\.\\");
        /* findfirst seems to fail with a different error. */
-       fnum1 = smbcli_nt_create_full(cli->tree, BASEDIR".\\.\\.\\.\\foo\\..\\.\\",
+       (void)smbcli_nt_create_full(cli->tree, BASEDIR".\\.\\.\\.\\foo\\..\\.\\",
                                      0, SEC_RIGHTS_FILE_ALL,
                                      FILE_ATTRIBUTE_NORMAL,
                                      NTCREATEX_SHARE_ACCESS_DELETE|
@@ -245,7 +244,7 @@ static bool test_chkpath(struct smbcli_state *cli, struct torture_context *tctx)
        /* We expect this open to fail with the same error code as the chkpath below. */
        /* findfirst seems to fail with a different error. */
        printf("Testing Open on %s\n", BASEDIR "\\nt\\V S\\VB98\\vb6.exe\\3");
-       fnum1 = smbcli_nt_create_full(cli->tree, BASEDIR "\\nt\\V S\\VB98\\vb6.exe\\3",
+       (void)smbcli_nt_create_full(cli->tree, BASEDIR "\\nt\\V S\\VB98\\vb6.exe\\3",
                                      0, SEC_RIGHTS_FILE_ALL,
                                      FILE_ATTRIBUTE_NORMAL,
                                      NTCREATEX_SHARE_ACCESS_DELETE|
index 127745e38e8bb77bb4200bf1dd622679bd563c2c..e90b8346aadad4547fdac4d9f04fb4693f804214 100644 (file)
@@ -2040,7 +2040,6 @@ static bool test_stacking(struct torture_context *tctx, struct smbcli_state *cli
        int fnum1;
        const char *fname = BASEDIR "\\stacking.txt";
        struct smb_lock_entry lock1;
-       struct smb_lock_entry lock2;
 
        torture_comment(tctx, "Testing stacking:\n");
 
@@ -2062,9 +2061,6 @@ static bool test_stacking(struct torture_context *tctx, struct smbcli_state *cli
        lock1.pid = cli->session->pid;
        lock1.offset = 0;
        lock1.count = 10;
-       lock2.pid = cli->session->pid - 1;
-       lock2.offset = 0;
-       lock2.count = 10;
 
        /**
         * Try to take a shared lock, then stack an exclusive.
index 6c4ca8266880a91ea72aeca339cb3e8a7143daa9..402974cb66b4297ceca47c5d119aa5905f047dda 100644 (file)
@@ -1482,7 +1482,7 @@ static bool test_notify_tcon(struct smbcli_state *cli, struct torture_context *t
        NTSTATUS status;
        union smb_notify notify;
        union smb_open io;
-       int fnum, fnum2;
+       int fnum;
        struct smbcli_request *req;
        extern int torture_numops;
        struct smbcli_tree *tree = NULL;
@@ -1511,7 +1511,6 @@ static bool test_notify_tcon(struct smbcli_state *cli, struct torture_context *t
 
        status = smb_raw_open(cli->tree, torture, &io);
        CHECK_STATUS(status, NT_STATUS_OK);
-       fnum2 = io.ntcreatex.out.file.fnum;
 
        /* ask for a change notify,
           on file or directory name changes */
index 46f2ed32301248b519b17f83d42b00e8c1f093d2..d3c7aae0250fea5af7b03e42bca7e9811ff3e1cf 100644 (file)
@@ -3550,7 +3550,6 @@ static bool test_raw_oplock_brl1(struct torture_context *tctx,
        /*int fname, f;*/
        bool ret = true;
        uint8_t buf[1000];
-       bool correct = true;
        union smb_open io;
        NTSTATUS status;
        uint16_t fnum=0;
@@ -3602,7 +3601,6 @@ static bool test_raw_oplock_brl1(struct torture_context *tctx,
                         sizeof(buf))
        {
                torture_comment(tctx, "Failed to create file\n");
-               correct = false;
                goto done;
        }
 
@@ -3662,7 +3660,6 @@ static bool test_raw_oplock_brl2(struct torture_context *tctx, struct smbcli_sta
        /*int fname, f;*/
        bool ret = true;
        uint8_t buf[1000];
-       bool correct = true;
        union smb_open io;
        NTSTATUS status;
        uint16_t fnum=0;
@@ -3715,7 +3712,6 @@ static bool test_raw_oplock_brl2(struct torture_context *tctx, struct smbcli_sta
                         sizeof(buf))
        {
                torture_comment(tctx, "Failed to create file\n");
-               correct = false;
                goto done;
        }
 
@@ -3868,7 +3864,6 @@ static bool test_raw_oplock_brl4(struct torture_context *tctx,
        const char *fname = BASEDIR "\\test_batch_brl.dat";
        bool ret = true;
        uint8_t buf[1000];
-       bool correct = true;
        union smb_open io;
        NTSTATUS status;
        uint16_t fnum = 0;
@@ -3918,7 +3913,6 @@ static bool test_raw_oplock_brl4(struct torture_context *tctx,
                         sizeof(buf))
        {
                torture_comment(tctx, "Failed to create file\n");
-               correct = false;
                goto done;
        }
 
index 59e127bf155c17ee15b68f74262c5cf6704637e0..ee8f7c8ba3c38f2e1b9ffc6faa97d3a251f385ae 100644 (file)
@@ -462,6 +462,10 @@ static bool oplock_handler_ack_to_none(struct smbcli_transport *transport,
        sfinfo.disposition_info.in.file.fnum = fnum;
        sfinfo.disposition_info.in.delete_on_close = 1;
        req = smb_raw_setfileinfo_send(ud_cli_state->cli1->tree, &sfinfo);
+       if (!req) {
+               torture_comment(ud_cli_state->tctx, "smb_raw_setfileinfo_send "
+                       "failed.");
+       }
 
        smbcli_close(ud_cli_state->cli1->tree, fnum);
 
@@ -482,7 +486,6 @@ static bool test_unlink_defer(struct torture_context *tctx,
        bool ret = true;
        union smb_open io;
        union smb_unlink unl;
-       uint16_t fnum=0;
        struct unlink_defer_cli_state ud_cli_state = {};
 
        if (!torture_setup_dir(cli1, BASEDIR)) {
@@ -519,7 +522,6 @@ static bool test_unlink_defer(struct torture_context *tctx,
 
        status = smb_raw_open(cli1->tree, tctx, &io);
        CHECK_STATUS(status, NT_STATUS_OK);
-       fnum = io.ntcreatex.out.file.fnum;
 
        /* cli2: Try to unlink it, but block on the oplock */
        torture_comment(tctx, "Try an unlink (should defer the open\n");