From 5d2af68a25534bd84601f3ac40853ef9fcb21edb Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 12 Jun 2012 17:56:43 +0200 Subject: s3:smbd: use FNUM_FIELD_INVALID instead of literal -1 This is in preparation of changing fnum to uint64_t Signed-off-by: Stefan Metzmacher --- source3/smbd/files.c | 4 ++-- source3/smbd/posix_acls.c | 2 +- source3/smbd/smb2_ioctl.c | 2 +- source3/smbd/trans2.c | 14 +++++++++----- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/source3/smbd/files.c b/source3/smbd/files.c index 12ec04cd3b..ada9d67bc4 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -82,7 +82,7 @@ NTSTATUS fsp_new(struct connection_struct *conn, TALLOC_CTX *mem_ctx, fsp->fh->ref_count = 1; fsp->fh->fd = -1; - fsp->fnum = -1; + fsp->fnum = FNUM_FIELD_INVALID; fsp->conn = conn; DLIST_ADD(sconn->files, fsp); @@ -581,7 +581,7 @@ static struct files_struct *file_fnum(struct smbd_server_connection *sconn, int count=0; for (fsp=sconn->files; fsp; fsp=fsp->next, count++) { - if (fsp->fnum == -1) { + if (fsp->fnum == FNUM_FIELD_INVALID) { continue; } diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c index e2571ff248..9753bfeb61 100644 --- a/source3/smbd/posix_acls.c +++ b/source3/smbd/posix_acls.c @@ -4878,7 +4878,7 @@ struct security_descriptor *get_nt_acl_no_snum( TALLOC_CTX *ctx, const char *fna ZERO_STRUCT( finfo ); ZERO_STRUCT( fh ); - finfo.fnum = -1; + finfo.fnum = FNUM_FIELD_INVALID; finfo.conn = conn; finfo.fh = &fh; finfo.fh->fd = -1; diff --git a/source3/smbd/smb2_ioctl.c b/source3/smbd/smb2_ioctl.c index 7710a9ebb2..db1ef0883e 100644 --- a/source3/smbd/smb2_ioctl.c +++ b/source3/smbd/smb2_ioctl.c @@ -372,7 +372,7 @@ static struct tevent_req *smbd_smb2_ioctl_send(TALLOC_CTX *mem_ctx, DEBUG(10, ("smbd_smb2_ioctl: ctl_code[0x%08x] %s fnum[%d]\n", (unsigned)in_ctl_code, fsp ? fsp_str_dbg(fsp) : "", - fsp ? fsp->fnum : -1)); + fsp ? fsp->fnum : FNUM_FIELD_INVALID)); smbreq = smbd_smb2_fake_smb_request(smb2req); if (tevent_req_nomem(smbreq, req)) { diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 3787fa9721..b83eb9e1c3 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -3271,7 +3271,7 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned ZERO_STRUCT(quotas); fsp.conn = conn; - fsp.fnum = -1; + fsp.fnum = FNUM_FIELD_INVALID; /* access check */ if (get_current_uid(conn) != 0) { @@ -4290,7 +4290,8 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn, } DEBUG(5,("smbd_do_qfilepathinfo: %s (fnum = %d) level=%d max_data=%u\n", - smb_fname_str_dbg(smb_fname), fsp ? fsp->fnum : -1, + smb_fname_str_dbg(smb_fname), + fsp ? fsp->fnum : FNUM_FIELD_INVALID, info_level, max_data_bytes)); mode = dos_mode(conn, smb_fname); @@ -5323,7 +5324,8 @@ static void call_trans2qfilepathinfo(connection_struct *conn, DEBUG(3,("call_trans2qfilepathinfo %s (fnum = %d) level=%d call=%d " "total_data=%d\n", smb_fname_str_dbg(smb_fname), - fsp ? fsp->fnum : -1, info_level,tran_call,total_data)); + fsp ? fsp->fnum : FNUM_FIELD_INVALID, + info_level,tran_call,total_data)); /* Pull out any data sent here before we realloc. */ switch (info_level) { @@ -7654,7 +7656,8 @@ NTSTATUS smbd_do_setfilepathinfo(connection_struct *conn, DEBUG(3,("smbd_do_setfilepathinfo: %s (fnum %d) info_level=%d " "totdata=%d\n", smb_fname_str_dbg(smb_fname), - fsp ? fsp->fnum : -1, info_level, total_data)); + fsp ? fsp->fnum : FNUM_FIELD_INVALID, + info_level, total_data)); switch (info_level) { @@ -8077,7 +8080,8 @@ static void call_trans2setfilepathinfo(connection_struct *conn, DEBUG(3,("call_trans2setfilepathinfo(%d) %s (fnum %d) info_level=%d " "totdata=%d\n", tran_call, smb_fname_str_dbg(smb_fname), - fsp ? fsp->fnum : -1, info_level,total_data)); + fsp ? fsp->fnum : FNUM_FIELD_INVALID, + info_level,total_data)); /* Realloc the parameter size */ *pparams = (char *)SMB_REALLOC(*pparams,2); -- cgit