diff options
author | Andrew Tridgell <tridge@samba.org> | 1998-08-16 05:23:54 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 1998-08-16 05:23:54 +0000 |
commit | 6daa579e0f76a9318bcac9442d7209580bb58bbc (patch) | |
tree | f5e79cf9ef1dbebc9c00b189489100e46631b9c1 /source3/locking | |
parent | 23294e6fc1a6270067b7745ccaea1117a706e361 (diff) | |
download | samba-6daa579e0f76a9318bcac9442d7209580bb58bbc.tar.gz samba-6daa579e0f76a9318bcac9442d7209580bb58bbc.tar.bz2 samba-6daa579e0f76a9318bcac9442d7209580bb58bbc.zip |
fixed some bugs in the locking_slow code caused by the recent changes.
also fixed a couple of %s/%d bugs in locking slow that have been there
for a while but are now revealed by the gcc printf argument testing.
(This used to be commit 16228c185a7844a243db538aa1e5729e62a8bc4a)
Diffstat (limited to 'source3/locking')
-rw-r--r-- | source3/locking/locking_slow.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/source3/locking/locking_slow.c b/source3/locking/locking_slow.c index 8b56e7599b..2017f09289 100644 --- a/source3/locking/locking_slow.c +++ b/source3/locking/locking_slow.c @@ -290,7 +290,8 @@ static int read_share_file(connection_struct *conn, int fd, char *fname, char ** /* Allocate space for the file */ if((buf = (char *)malloc(sb.st_size)) == NULL) { - DEBUG(0,("read_share_file: malloc for file size %d fail !\n", sb.st_size)); + DEBUG(0,("read_share_file: malloc for file size %d fail !\n", + (int)sb.st_size)); return -1; } @@ -399,7 +400,7 @@ static int slow_get_share_modes(connection_struct *conn, int token, uint32 dev, if(num_entries < 0) { DEBUG(0,("PANIC ERROR:get_share_mode: num_share_mode_entries < 0 (%d) \ -for share file %d\n", num_entries, fname)); +for share file %s\n", num_entries, fname)); return 0; } @@ -573,7 +574,7 @@ static void slow_del_share_mode(int token, files_struct *fsp) if(num_entries < 0) { DEBUG(0,("PANIC ERROR:del_share_mode: num_share_mode_entries < 0 (%d) \ -for share file %d\n", num_entries, fname)); +for share file %s\n", num_entries, fname)); return; } @@ -703,7 +704,7 @@ static BOOL slow_set_share_mode(int token,files_struct *fsp, uint16 port, uint16 if((buf = (char *)malloc(sb.st_size + SMF_ENTRY_LENGTH)) == NULL) { DEBUG(0,("set_share_mode: malloc for file size %d fail !\n", - sb.st_size + SMF_ENTRY_LENGTH)); + (int)(sb.st_size + SMF_ENTRY_LENGTH))); return False; } @@ -754,15 +755,15 @@ deleting it.\n", fname)); { /* New file - just use a single_entry. */ if((buf = (char *)malloc(SMF_HEADER_LENGTH + - strlen(fsp->name) + 1 + SMF_ENTRY_LENGTH)) == NULL) + strlen(fsp->fsp_name) + 1 + SMF_ENTRY_LENGTH)) == NULL) { DEBUG(0,("ERROR: set_share_mode: malloc failed for single entry.\n")); return False; } SIVAL(buf,SMF_VERSION_OFFSET,LOCKING_VERSION); SIVAL(buf,SMF_NUM_ENTRIES_OFFSET,0); - SSVAL(buf,SMF_FILENAME_LEN_OFFSET,strlen(fsp->name) + 1); - pstrcpy(buf + SMF_HEADER_LENGTH, fsp->name); + SSVAL(buf,SMF_FILENAME_LEN_OFFSET,strlen(fsp->fsp_name) + 1); + pstrcpy(buf + SMF_HEADER_LENGTH, fsp->fsp_name); } num_entries = IVAL(buf,SMF_NUM_ENTRIES_OFFSET); @@ -863,7 +864,7 @@ deleting it.\n", fname)); if(num_entries < 0) { DEBUG(0,("PANIC ERROR:remove_share_oplock: num_share_mode_entries < 0 (%d) \ -for share file %d\n", num_entries, fname)); +for share file %s\n", num_entries, fname)); return False; } |