summaryrefslogtreecommitdiffstats
path: root/mbbsd/brc.c
diff options
context:
space:
mode:
authorkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2006-04-08 22:20:03 +0800
committerkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2006-04-08 22:20:03 +0800
commitabd9d4e39f7294a9006fad1b5907276de45146c6 (patch)
treeb43e5a3d523ff83ed3f719f787127f8f4f8a7e8d /mbbsd/brc.c
parent16cc4b8824babdc2d18c7c70cd1c6ea612dd5ee0 (diff)
downloadpttbbs-abd9d4e39f7294a9006fad1b5907276de45146c6.tar
pttbbs-abd9d4e39f7294a9006fad1b5907276de45146c6.tar.gz
pttbbs-abd9d4e39f7294a9006fad1b5907276de45146c6.tar.bz2
pttbbs-abd9d4e39f7294a9006fad1b5907276de45146c6.tar.lz
pttbbs-abd9d4e39f7294a9006fad1b5907276de45146c6.tar.xz
pttbbs-abd9d4e39f7294a9006fad1b5907276de45146c6.tar.zst
pttbbs-abd9d4e39f7294a9006fad1b5907276de45146c6.zip
make different tmp file to avoid open same file for write.
(however, open with "w" flag will write to different inode, so won't make things corruption) git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3323 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/brc.c')
-rw-r--r--mbbsd/brc.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/mbbsd/brc.c b/mbbsd/brc.c
index d32e989b..f30bef17 100644
--- a/mbbsd/brc.c
+++ b/mbbsd/brc.c
@@ -321,8 +321,7 @@ brc_finalize(){
int ok=0;
brc_update();
setuserfile(brcfile, fn_brc);
- setuserfile(tmpfile, fn_brc);
- strlcat(tmpfile, ".tmp", sizeof(tmpfile));
+ snprintf(tmpfile, sizeof(tmpfile), "%s.tmp.%x", brcfile, getpid());
if (brc_buf != NULL &&
(fd = open(tmpfile, O_WRONLY | O_CREAT | O_TRUNC, 0644)) != -1) {
if(write(fd, brc_buf, brc_size)==brc_size)