From 3e6e1aed949a4483fc38607e443b5c8b715aca3b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 21 Nov 2011 13:06:00 -0800 Subject: Fix a bunch of "warning: variable ‘XXXX’ set but not used [-Wunused-but-set-variable]" warnings from the new gcc. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Autobuild-User: Jeremy Allison Autobuild-Date: Mon Nov 21 23:39:08 CET 2011 on sn-devel-104 --- auth/credentials/credentials_krb5.c | 4 ++-- auth/credentials/credentials_secrets.c | 2 -- lib/tdb/tools/tdbtool.c | 4 +--- lib/util/util_runcmd.c | 3 +-- source4/torture/basic/base.c | 3 --- source4/torture/basic/delaywrite.c | 24 ++++++++---------------- source4/torture/basic/delete.c | 3 +-- source4/torture/basic/disconnect.c | 12 +++++++++++- source4/torture/raw/chkpath.c | 7 +++---- source4/torture/raw/lock.c | 4 ---- source4/torture/raw/notify.c | 3 +-- source4/torture/raw/oplock.c | 6 ------ source4/torture/raw/unlink.c | 6 ++++-- 13 files changed, 32 insertions(+), 49 deletions(-) diff --git a/auth/credentials/credentials_krb5.c b/auth/credentials/credentials_krb5.c index 7130e4164d..1b7be3f63c 100644 --- a/auth/credentials/credentials_krb5.c +++ b/auth/credentials/credentials_krb5.c @@ -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; } diff --git a/auth/credentials/credentials_secrets.c b/auth/credentials/credentials_secrets.c index d86032a564..bc08d9da9a 100644 --- a/auth/credentials/credentials_secrets.c +++ b/auth/credentials/credentials_secrets.c @@ -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); diff --git a/lib/tdb/tools/tdbtool.c b/lib/tdb/tools/tdbtool.c index 99d4841cf3..d4b85dcdb1 100644 --- a/lib/tdb/tools/tdbtool.c +++ b/lib/tdb/tools/tdbtool.c @@ -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++; diff --git a/lib/util/util_runcmd.c b/lib/util/util_runcmd.c index d617254432..cfe0034a32 100644 --- a/lib/util/util_runcmd.c +++ b/lib/util/util_runcmd.c @@ -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; diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c index 10dc892333..cd0f61b681 100644 --- a/source4/torture/basic/base.c +++ b/source4/torture/basic/base.c @@ -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"); diff --git a/source4/torture/basic/delaywrite.c b/source4/torture/basic/delaywrite.c index 8a1dc1ba9d..939827ec3c 100644 --- a/source4/torture/basic/delaywrite.c +++ b/source4/torture/basic/delaywrite.c @@ -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); diff --git a/source4/torture/basic/delete.c b/source4/torture/basic/delete.c index deeeec8057..be538d0e9d 100644 --- a/source4/torture/basic/delete.c +++ b/source4/torture/basic/delete.c @@ -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, diff --git a/source4/torture/basic/disconnect.c b/source4/torture/basic/disconnect.c index 71471c7f0a..17fbc61d2f 100644 --- a/source4/torture/basic/disconnect.c +++ b/source4/torture/basic/disconnect.c @@ -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); diff --git a/source4/torture/raw/chkpath.c b/source4/torture/raw/chkpath.c index d000283685..ed7b5b2917 100644 --- a/source4/torture/raw/chkpath.c +++ b/source4/torture/raw/chkpath.c @@ -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| diff --git a/source4/torture/raw/lock.c b/source4/torture/raw/lock.c index 127745e38e..e90b8346aa 100644 --- a/source4/torture/raw/lock.c +++ b/source4/torture/raw/lock.c @@ -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. diff --git a/source4/torture/raw/notify.c b/source4/torture/raw/notify.c index 6c4ca82668..402974cb66 100644 --- a/source4/torture/raw/notify.c +++ b/source4/torture/raw/notify.c @@ -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 */ diff --git a/source4/torture/raw/oplock.c b/source4/torture/raw/oplock.c index 46f2ed3230..d3c7aae025 100644 --- a/source4/torture/raw/oplock.c +++ b/source4/torture/raw/oplock.c @@ -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; } diff --git a/source4/torture/raw/unlink.c b/source4/torture/raw/unlink.c index 59e127bf15..ee8f7c8ba3 100644 --- a/source4/torture/raw/unlink.c +++ b/source4/torture/raw/unlink.c @@ -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"); -- cgit