diff options
author | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-01-15 11:31:04 +0800 |
---|---|---|
committer | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-01-15 11:31:04 +0800 |
commit | 9dd03ea1cc5d09b19d5b45964758b1a742bd2151 (patch) | |
tree | 144ea0298dbd93cea9299f04f1af6eb3e5ca30d0 | |
parent | eee7c9d7dc3f011a263d847ad43e68b6ba9ecf19 (diff) | |
download | pttbbs-9dd03ea1cc5d09b19d5b45964758b1a742bd2151.tar pttbbs-9dd03ea1cc5d09b19d5b45964758b1a742bd2151.tar.gz pttbbs-9dd03ea1cc5d09b19d5b45964758b1a742bd2151.tar.bz2 pttbbs-9dd03ea1cc5d09b19d5b45964758b1a742bd2151.tar.lz pttbbs-9dd03ea1cc5d09b19d5b45964758b1a742bd2151.tar.xz pttbbs-9dd03ea1cc5d09b19d5b45964758b1a742bd2151.tar.zst pttbbs-9dd03ea1cc5d09b19d5b45964758b1a742bd2151.zip |
do fav_cleanup() after loading from .fav4
(to avoid mis-cleanup cause by corrupt brd)
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2398 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | mbbsd/fav.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/mbbsd/fav.c b/mbbsd/fav.c index b2a267df..1e978c25 100644 --- a/mbbsd/fav.c +++ b/mbbsd/fav.c @@ -455,6 +455,7 @@ static void read_favrec(int fd, fav_t *fp) /** * 從記錄檔中 load 出我的最愛。 + * @note fav_cleanup() 會先被呼叫。 */ int fav_load(void) { @@ -478,8 +479,9 @@ int fav_load(void) return -1; fp = (fav_t *)fav_malloc(sizeof(fav_t)); read_favrec(fd, fp); - fav_stack_push_fav(fp); close(fd); + fav_stack_push_fav(fp); + fav_cleanup(); #ifdef MEM_CHECK fav_set_memcheck(MEM_CHECK); #endif @@ -511,7 +513,7 @@ static void write_favrec(int fd, fav_t *fp) /** * 把記錄檔 save 進我的最愛。 - * @note fav_cleanup() 會先被呼叫。 + * @note fav_cleanup() 在 fav_load() 時做,避免看板欄掉時,下站被搞亂 fav。 */ int fav_save(void) { @@ -524,7 +526,6 @@ int fav_save(void) #endif if (fp == NULL) return -1; - fav_cleanup(); setuserfile(buf, FAV4".tmp"); setuserfile(buf2, FAV4); fd = open(buf, O_CREAT | O_WRONLY, 0600); |