summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-03-08 00:01:56 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-03-08 00:01:56 +0800
commit1812d5521f71bf6726cd959308cb4628c5a1951c (patch)
treef61c5be32e335668ddddeca1e28459605a220b6c /src
parent80d861dff5d757ef5827054a0633fdbe56ff356a (diff)
downloadpttbbs-1812d5521f71bf6726cd959308cb4628c5a1951c.tar
pttbbs-1812d5521f71bf6726cd959308cb4628c5a1951c.tar.gz
pttbbs-1812d5521f71bf6726cd959308cb4628c5a1951c.tar.bz2
pttbbs-1812d5521f71bf6726cd959308cb4628c5a1951c.tar.lz
pttbbs-1812d5521f71bf6726cd959308cb4628c5a1951c.tar.xz
pttbbs-1812d5521f71bf6726cd959308cb4628c5a1951c.tar.zst
pttbbs-1812d5521f71bf6726cd959308cb4628c5a1951c.zip
- register: Regform2 API prototype (for concurrent registration form validation) [not applied yet]
- file/passwd/assess: API finetune - menu: menu item finetune git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3975 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'src')
-rw-r--r--src/libbbsutil/file.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libbbsutil/file.c b/src/libbbsutil/file.c
index 5cc0b541..21313283 100644
--- a/src/libbbsutil/file.c
+++ b/src/libbbsutil/file.c
@@ -203,7 +203,11 @@ Rename(const char *src, const char *dst)
if (pid == 0)
execl("/bin/mv", "mv", "-f", src, dst, (char *)NULL);
else if (pid > 0)
- waitpid(pid, NULL, 0);
+ {
+ int status = -1;
+ waitpid(pid, &status, 0);
+ return WEXITSTATUS(status) == 0 ? 0 : -1;
+ }
else
return -1;
}
@@ -262,6 +266,7 @@ AppendTail(const char *src, const char *dst, int off)
fo=open(dst, O_WRONLY | O_APPEND | O_CREAT, 0600);
if(fo<0) {close(fi); return -1;}
+ // flock(dst, LOCK_SH);
if(off > 0)
lseek(fi, (off_t)off, SEEK_SET);
@@ -270,6 +275,7 @@ AppendTail(const char *src, const char *dst, int off)
{
write(fo, buf, bytes);
}
+ // flock(dst, LOCK_UN);
close(fo);
close(fi);
return 0;