Skip to content
Snippets Groups Projects
Commit 3c4f7e9b authored by rswindell's avatar rswindell
Browse files

Remove calls to setvbuf() - you can toggle buffering off and then on again

like that.
parent bf22a7bc
No related branches found
No related tags found
No related merge requests found
...@@ -104,7 +104,6 @@ int SMBCALL smb_open(smb_t* smb) ...@@ -104,7 +104,6 @@ int SMBCALL smb_open(smb_t* smb)
memset(&(smb->status),0,sizeof(smb->status)); memset(&(smb->status),0,sizeof(smb->status));
if(filelength(fileno(smb->shd_fp))>=(long)sizeof(smbhdr_t)) { if(filelength(fileno(smb->shd_fp))>=(long)sizeof(smbhdr_t)) {
setvbuf(smb->shd_fp,NULL,_IONBF,SHD_BLOCK_LEN);
if(smb_locksmbhdr(smb)!=SMB_SUCCESS) { if(smb_locksmbhdr(smb)!=SMB_SUCCESS) {
smb_close(smb); smb_close(smb);
/* smb_lockmsghdr set last_error */ /* smb_lockmsghdr set last_error */
...@@ -146,8 +145,6 @@ int SMBCALL smb_open(smb_t* smb) ...@@ -146,8 +145,6 @@ int SMBCALL smb_open(smb_t* smb)
rewind(smb->shd_fp); rewind(smb->shd_fp);
} }
setvbuf(smb->shd_fp,NULL,_IOFBF,SHD_BLOCK_LEN);
if((i=smb_open_fp(smb,&smb->sdt_fp,SH_DENYNO))!=SMB_SUCCESS) if((i=smb_open_fp(smb,&smb->sdt_fp,SH_DENYNO))!=SMB_SUCCESS)
return(i); return(i);
...@@ -371,7 +368,6 @@ int SMBCALL smb_getstatus(smb_t* smb) ...@@ -371,7 +368,6 @@ int SMBCALL smb_getstatus(smb_t* smb)
safe_snprintf(smb->last_error,sizeof(smb->last_error),"msgbase not open"); safe_snprintf(smb->last_error,sizeof(smb->last_error),"msgbase not open");
return(SMB_ERR_NOT_OPEN); return(SMB_ERR_NOT_OPEN);
} }
setvbuf(smb->shd_fp,NULL,_IONBF,SHD_BLOCK_LEN);
clearerr(smb->shd_fp); clearerr(smb->shd_fp);
if(fseek(smb->shd_fp,sizeof(smbhdr_t),SEEK_SET)) { if(fseek(smb->shd_fp,sizeof(smbhdr_t),SEEK_SET)) {
safe_snprintf(smb->last_error,sizeof(smb->last_error) safe_snprintf(smb->last_error,sizeof(smb->last_error)
...@@ -380,7 +376,6 @@ int SMBCALL smb_getstatus(smb_t* smb) ...@@ -380,7 +376,6 @@ int SMBCALL smb_getstatus(smb_t* smb)
return(SMB_ERR_SEEK); return(SMB_ERR_SEEK);
} }
i=smb_fread(smb,&(smb->status),sizeof(smbstatus_t),smb->shd_fp); i=smb_fread(smb,&(smb->status),sizeof(smbstatus_t),smb->shd_fp);
setvbuf(smb->shd_fp,NULL,_IOFBF,SHD_BLOCK_LEN);
if(i==sizeof(smbstatus_t)) if(i==sizeof(smbstatus_t))
return(SMB_SUCCESS); return(SMB_SUCCESS);
safe_snprintf(smb->last_error,sizeof(smb->last_error) safe_snprintf(smb->last_error,sizeof(smb->last_error)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment