summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormhsin <mhsin@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-07-05 18:00:23 +0800
committermhsin <mhsin@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-07-05 18:00:23 +0800
commit1cad31359a182ffa1b3e5358c9addd85ba605874 (patch)
tree131b51ae968ef38141b34349ec2318848bdaf0e8
parent0cafa411998253b5a07293d5005919f1e28ed8a7 (diff)
downloadpttbbs-1cad31359a182ffa1b3e5358c9addd85ba605874.tar
pttbbs-1cad31359a182ffa1b3e5358c9addd85ba605874.tar.gz
pttbbs-1cad31359a182ffa1b3e5358c9addd85ba605874.tar.bz2
pttbbs-1cad31359a182ffa1b3e5358c9addd85ba605874.tar.lz
pttbbs-1cad31359a182ffa1b3e5358c9addd85ba605874.tar.xz
pttbbs-1cad31359a182ffa1b3e5358c9addd85ba605874.tar.zst
pttbbs-1cad31359a182ffa1b3e5358c9addd85ba605874.zip
Fix file timestamping for vote report and innbbsd.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4724 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--innbbsd/receive_article.c4
-rw-r--r--mbbsd/vote.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/innbbsd/receive_article.c b/innbbsd/receive_article.c
index becdda61..f79096b6 100644
--- a/innbbsd/receive_article.c
+++ b/innbbsd/receive_article.c
@@ -295,6 +295,7 @@ receive_article()
"OCAgIFNreXBlOmp1bnNreWVwCg==", "ooqq.bbs@bbs.wretch.cc",
"http://jsvcd.3cc.cc", "http://bestgirl.mytw.net", "http://98.to/",
"http://www.boss888.net", "amuro.bbs@bbs.csie.nctu.edu.tw",
+ "請問有需要幫忙報告.論文spss統計分析嗎",
"http://www.whymsi.com", "http://www.msi-team.com/", NULL};
#endif
@@ -739,7 +740,8 @@ post_article(homepath, userid, board, writebody, pathname, firstpath)
now = time(NULL);
while (1) {
- sprintf(name, "M.%ld.A", (long)++now);
+ /* TODO: extract record.c:stampfile_u() to common lib */
+ sprintf(name, "M.%ld.A.%3.3X", (long)++now, (unsigned int)(random() & 0xFFF));
sprintf(article, "%s/%s", homepath, name);
fh = open(article, O_CREAT | O_EXCL | O_WRONLY, 0644);
if (fh >= 0)
diff --git a/mbbsd/vote.c b/mbbsd/vote.c
index 39c5eb67..8eb2c756 100644
--- a/mbbsd/vote.c
+++ b/mbbsd/vote.c
@@ -144,7 +144,8 @@ vote_report(const char *bname, const char *fname, char *fpath)
dtime = now;
for (;;) {
- sprintf(ip, "M.%d.A", (int)++dtime);
+ /* TODO: extract record.c:stampfile_u() to common lib */
+ sprintf(ip, "M.%d.A.%3.3X", (int)++dtime, (unsigned int)(random() & 0xFFF));
fd = open(fpath, O_CREAT | O_EXCL | O_WRONLY, 0644);
if (fd >= 0)
break;
@@ -152,6 +153,7 @@ vote_report(const char *bname, const char *fname, char *fpath)
}
close(fd);
+ /* XXX: FIXME: Possible race condition */
unlink(fpath);
link(fname, fpath);