From 0e2c7d5251246b02b47d0f94fb894a499a49d3cd Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Wed, 29 Dec 2004 04:27:06 +0000 Subject: [PATCH] Minor optimization in smb_open_fp() - no need to call sprintf() if the file stream is already open. --- src/smblib/smbfile.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/smblib/smbfile.c b/src/smblib/smbfile.c index 578a4d5809..af924eb297 100644 --- a/src/smblib/smbfile.c +++ b/src/smblib/smbfile.c @@ -151,11 +151,12 @@ int SMBCALL smb_open_fp(smb_t* smb, FILE** fp, int share) ,smb->file, fp); return(SMB_ERR_OPEN); } - SAFEPRINTF2(path,"%s.%s",smb->file,ext); if(*fp!=NULL) /* Already open! */ return(SMB_SUCCESS); + SAFEPRINTF2(path,"%s.%s",smb->file,ext); + while(1) { if((file=sopen(path,O_RDWR|O_CREAT|O_BINARY,share,S_IREAD|S_IWRITE))!=-1) break; -- GitLab