summaryrefslogtreecommitdiffstats
path: root/mbbsd/fav.c
diff options
context:
space:
mode:
Diffstat (limited to 'mbbsd/fav.c')
-rw-r--r--mbbsd/fav.c7
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);