diff options
author | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-11-22 14:46:09 +0800 |
---|---|---|
committer | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-11-22 14:46:09 +0800 |
commit | ea46a614edc90d2817255193de2c6f3bb9601a8e (patch) | |
tree | f2b134351fc5f787fe3976a2a6d263fcecfc5641 | |
parent | 3623e3c2d7ba602e022ed14496135f1c9073386d (diff) | |
download | pttbbs-ea46a614edc90d2817255193de2c6f3bb9601a8e.tar pttbbs-ea46a614edc90d2817255193de2c6f3bb9601a8e.tar.gz pttbbs-ea46a614edc90d2817255193de2c6f3bb9601a8e.tar.bz2 pttbbs-ea46a614edc90d2817255193de2c6f3bb9601a8e.tar.lz pttbbs-ea46a614edc90d2817255193de2c6f3bb9601a8e.tar.xz pttbbs-ea46a614edc90d2817255193de2c6f3bb9601a8e.tar.zst pttbbs-ea46a614edc90d2817255193de2c6f3bb9601a8e.zip |
missing close(fd)
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@1359 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | pttbbs/mbbsd/fav.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/pttbbs/mbbsd/fav.c b/pttbbs/mbbsd/fav.c index 6590e57e..9479979e 100644 --- a/pttbbs/mbbsd/fav.c +++ b/pttbbs/mbbsd/fav.c @@ -866,18 +866,17 @@ int fav_v3_to_v4(void) fav3_board_t *brd; setuserfile(buf, FAV4); - fd = open(buf, O_RDONLY); - if (fd >= 0){ - close(fd); + if (dashf(buf)) return 0; - } fdw = open(buf, O_WRONLY | O_CREAT | O_TRUNC, 0600); if (fdw < 0) return -1; setuserfile(buf, FAV3); fd = open(buf, O_RDONLY); - if (fd < 0) + if (fd < 0) { + close(fdw); return -1; + } read(fd, &nDatas, sizeof(nDatas)); read(fd, &nLines, sizeof(nLines)); @@ -917,5 +916,7 @@ int fav_v3_to_v4(void) write_favrec(fdw, fav4); fav_free_branch(fav4); free(brd); + close(fd); + close(fdw); return 0; } |