diff options
-rw-r--r-- | innbbsd/receive_article.c | 4 | ||||
-rw-r--r-- | mbbsd/vote.c | 4 |
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); |