summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-02-15 01:40:20 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-02-15 01:40:20 +0800
commitf0aa3c3fdcef644d9bbc7c9bd67d28c194e0cf0b (patch)
treefcf49b1397db724329e44dddf6d28658005ff404
parenta66d804a6806447e3d4672035bb8f9a29a782f2e (diff)
downloadpttbbs-f0aa3c3fdcef644d9bbc7c9bd67d28c194e0cf0b.tar
pttbbs-f0aa3c3fdcef644d9bbc7c9bd67d28c194e0cf0b.tar.gz
pttbbs-f0aa3c3fdcef644d9bbc7c9bd67d28c194e0cf0b.tar.bz2
pttbbs-f0aa3c3fdcef644d9bbc7c9bd67d28c194e0cf0b.tar.lz
pttbbs-f0aa3c3fdcef644d9bbc7c9bd67d28c194e0cf0b.tar.xz
pttbbs-f0aa3c3fdcef644d9bbc7c9bd67d28c194e0cf0b.tar.zst
pttbbs-f0aa3c3fdcef644d9bbc7c9bd67d28c194e0cf0b.zip
- verify if record entry is still valid before modifying.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3920 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/bbs.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 21088996..1f03f831 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -2332,6 +2332,16 @@ edit_title(int ent, fileheader_t * fhdr, const char *direct)
{
getdata(b_lines - 1, 0, "確定(Y/N)?[n] ", genbuf, 3, DOECHO);
if ((genbuf[0] == 'y' || genbuf[0] == 'Y') && dirty) {
+ // TODO verify if record is still valid
+ fileheader_t curr;
+ memset(&curr, 0, sizeof(curr));
+ if (get_record(direct, &curr, sizeof(curr), ent) < 0 ||
+ strcmp(curr.filename, fhdr->filename) != 0)
+ {
+ // modified...
+ vmsg("抱歉,系統忙碌中,請稍後再試。");
+ return FULLUPDATE;
+ }
*fhdr = tmpfhdr;
substitute_ref_record(direct, fhdr, ent);
}