comparison main.c @ 577:06675b69ca6c

Add O_TRUNC to configuration file saving flags.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 30 Dec 2012 08:20:47 +0200
parents 414d11df07ce
children 97a49a6cc959
comparison
equal deleted inserted replaced
576:414d11df07ce 577:06675b69ca6c
1033 } 1033 }
1034 1034
1035 #ifdef __WIN32 1035 #ifdef __WIN32
1036 if ((ctx.fp = fopen(setConfigFile, "w")) == NULL) 1036 if ((ctx.fp = fopen(setConfigFile, "w")) == NULL)
1037 #else 1037 #else
1038 if ((cfgfd = open(setConfigFile, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR)) == -1 || 1038 if ((cfgfd = open(setConfigFile, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR)) == -1 ||
1039 (ctx.fp = fdopen(cfgfd, "w")) == NULL) 1039 (ctx.fp = fdopen(cfgfd, "w")) == NULL)
1040 #endif 1040 #endif
1041 { 1041 {
1042 printMsgQ(currWin, "Could not create configuration to file '%s', %d: %s\n", 1042 printMsgQ(currWin, "Could not create configuration to file '%s', %d: %s\n",
1043 setConfigFile, errno, strerror(errno)); 1043 setConfigFile, errno, strerror(errno));