1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

Fix a bunch of "warning: variable ‘XXXX’ set but not used [-Wunused-but-set-variable]" warnings from the new gcc.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Mon Nov 21 23:39:08 CET 2011 on sn-devel-104
This commit is contained in:
Jeremy Allison 2011-11-21 13:06:00 -08:00
parent aa2e415442
commit 3e6e1aed94
13 changed files with 32 additions and 49 deletions

View 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;
}

View 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);

View 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++;

View 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;

View 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");

View 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);

View 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,

View 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);

View 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|

View 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.

View 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 */

View 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;
}

View 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");