From aa8a4c5d7537ceac4b747b2729dca6468e3344bf Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Tue, 9 Jan 2018 20:31:26 +1000 Subject: [PATCH] Work around some SunOS weirdness --- utils/magimail/src/magimail/dupe.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/utils/magimail/src/magimail/dupe.c b/utils/magimail/src/magimail/dupe.c index c21b032..acce399 100644 --- a/utils/magimail/src/magimail/dupe.c +++ b/utils/magimail/src/magimail/dupe.c @@ -137,11 +137,15 @@ bool OpenDupeDB(void) if(res == 0) { /* New file */ + osClose(dupefh); + dupefh=osOpen(config.cfg_DupeFile,MODE_NEWFILE); + LogWrite(3,TOSSINGINFO,"Creating new dupe file %s",config.cfg_DupeFile); - LogWrite(3,TOSSINGINFO,"Creating new dupe file %s",config.cfg_DupeFile); - - strcpy(buf,DUPES_IDENTIFIER); + strncpy(buf,DUPES_IDENTIFIER,4); osWrite(dupefh,buf,4); + osClose(dupefh); + dupefh=osOpen(config.cfg_DupeFile,MODE_READWRITE); + osSeek(dupefh, 4, OFFSET_BEGINNING); } else if(res != 4 || strcmp(buf,DUPES_IDENTIFIER)!=0) {