summaryrefslogtreecommitdiffstats
path: root/mbbsd/bbs.c
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-12-15 17:53:37 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-12-15 17:53:37 +0800
commit6cd1e2dd9904da07992c18b77f0586a4d77b61de (patch)
treef0262f726c6a3fba2f7fadaea15b9c31d34d6e0b /mbbsd/bbs.c
parentc7179929b7a8a7e56abb07d57fd9e7936a2ca16e (diff)
downloadpttbbs-6cd1e2dd9904da07992c18b77f0586a4d77b61de.tar
pttbbs-6cd1e2dd9904da07992c18b77f0586a4d77b61de.tar.gz
pttbbs-6cd1e2dd9904da07992c18b77f0586a4d77b61de.tar.bz2
pttbbs-6cd1e2dd9904da07992c18b77f0586a4d77b61de.tar.lz
pttbbs-6cd1e2dd9904da07992c18b77f0586a4d77b61de.tar.xz
pttbbs-6cd1e2dd9904da07992c18b77f0586a4d77b61de.tar.zst
pttbbs-6cd1e2dd9904da07992c18b77f0586a4d77b61de.zip
add SAFE_ARTICLE_DELETE,
when using 'd' to delete an article, do not truncate .DIR immediately but add an empty record into the same place. this avoids many problems. (not complete yet) git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1407 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/bbs.c')
-rw-r--r--mbbsd/bbs.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index a0385552..659e6544 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -947,6 +947,11 @@ edit_post(int ent, fileheader_t * fhdr, char *direct)
if( currmode & MODE_SELECT )
return DONOTHING;
+#ifdef SAFE_ARTICLE_DELETE
+ if( fhdr->filename[0] == '.' )
+ return DONOTHING;
+#endif
+
setutmpmode(REEDIT);
setdirpath(genbuf, direct, fhdr->filename);
local_article = fhdr->filemode & FILE_LOCAL;
@@ -1833,7 +1838,13 @@ del_post(int ent, fileheader_t * fhdr, char *direct)
getdata(1, 0, msg_del_ny, genbuf, 3, LCECHO);
if (genbuf[0] == 'y') {
strlcpy(currfile, fhdr->filename, sizeof(currfile));
- if (!delete_file(direct, sizeof(fileheader_t), ent, cmpfilename)) {
+ if(
+#ifdef SAFE_ARTICLE_DELETE
+ !safe_article_delete(ent, fhdr, direct)
+#else
+ !delete_file(direct, sizeof(fileheader_t), ent, cmpfilename)
+#endif
+ ) {
int num;
if (currmode & MODE_SELECT) {
/* rocker.011018: §Q„Īreference“ī§Cloading */