summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2006-05-01 15:27:50 +0800
committervictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2006-05-01 15:27:50 +0800
commit7a5d6709b77119307a05acd1ba0665ab8f1334ac (patch)
tree3d55f5b15391df3f39ea854f7b9eab451e9a0e11
parentb33cce999a73a3afa0a896021845b529eff91793 (diff)
downloadpttbbs-7a5d6709b77119307a05acd1ba0665ab8f1334ac.tar
pttbbs-7a5d6709b77119307a05acd1ba0665ab8f1334ac.tar.gz
pttbbs-7a5d6709b77119307a05acd1ba0665ab8f1334ac.tar.bz2
pttbbs-7a5d6709b77119307a05acd1ba0665ab8f1334ac.tar.lz
pttbbs-7a5d6709b77119307a05acd1ba0665ab8f1334ac.tar.xz
pttbbs-7a5d6709b77119307a05acd1ba0665ab8f1334ac.tar.zst
pttbbs-7a5d6709b77119307a05acd1ba0665ab8f1334ac.zip
replace .fav4 only if ferror failed
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3351 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/fav.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/mbbsd/fav.c b/mbbsd/fav.c
index fa7d144c..ba1f2b50 100644
--- a/mbbsd/fav.c
+++ b/mbbsd/fav.c
@@ -590,9 +590,15 @@ int fav_save(void)
if(fwp == NULL)
return -1;
write_favrec(fwp, fp);
- fclose(fwp);
- Rename(buf, buf2);
+ fflush(fwp);
+ if (!ferror(fwp)) {
+ fclose(fwp);
+ Rename(buf, buf2);
+ }
+ else
+ fclose(fwp);
+
return 0;
}