From 4d11d9031b1328ecdb24a5659063a07d14940d56 Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Tue, 27 Sep 2005 09:19:09 +0000
Subject: [PATCH] Don't buffer index (.sid) files - see if this is the cause of
 large volume mail.sid corruption (blocks of records getting zero'd out).

---
 src/smblib/smbfile.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/smblib/smbfile.c b/src/smblib/smbfile.c
index af924eb297..01d78c9b3b 100644
--- a/src/smblib/smbfile.c
+++ b/src/smblib/smbfile.c
@@ -8,7 +8,7 @@
  * @format.tab-size 4		(Plain Text/Source Code File Header)			*
  * @format.use-tabs true	(see http://www.synchro.net/ptsc_hdr.html)		*
  *																			*
- * Copyright 2004 Rob Swindell - http://www.synchro.net/copyright.html		*
+ * Copyright 2005 Rob Swindell - http://www.synchro.net/copyright.html		*
  *																			*
  * This library is free software; you can redistribute it and/or			*
  * modify it under the terms of the GNU Lesser General Public License		*
@@ -184,7 +184,10 @@ int SMBCALL smb_open_fp(smb_t* smb, FILE** fp, int share)
 		close(file);
 		return(SMB_ERR_OPEN); 
 	}
-	setvbuf(*fp,NULL,_IOFBF,2*1024);
+	if(fp==&smb->sid_fp)
+		setvbuf(*fp,NULL,_IONBF,0);	/* no buffering (cause of *.sid corruption?) */
+	else
+		setvbuf(*fp,NULL,_IOFBF,2*1024);
 	return(SMB_SUCCESS);
 }
 
-- 
GitLab