From 9dd03ea1cc5d09b19d5b45964758b1a742bd2151 Mon Sep 17 00:00:00 2001 From: victor Date: Sat, 15 Jan 2005 03:31:04 +0000 Subject: 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 --- mbbsd/fav.c | 7 ++++--- 1 file 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); -- cgit v1.2.3