From 59114c5fad044272819e6cfb8dc8cfa0f78edd5d Mon Sep 17 00:00:00 2001 From: piaip Date: Fri, 25 Nov 2011 12:18:52 +0000 Subject: early return if append failed. git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5471 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- pttbbs/mbbsd/record.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pttbbs/mbbsd/record.c b/pttbbs/mbbsd/record.c index bba0fd79..4e73fe6f 100644 --- a/pttbbs/mbbsd/record.c +++ b/pttbbs/mbbsd/record.c @@ -499,9 +499,12 @@ append_record_forward(char *fpath, fileheader_t * record, int size, const char * int n; char address[64] = ""; char fwd_title[STRLEN] = ""; + int r; - // No matter what, append it. - append_record(fpath, record, size); + // No matter what, append it, and return if that failed. + r = append_record(fpath, record, size); + if (r != 0) + return r; // #ifdef USE_MAIL_AUTO_FORWARD @@ -523,6 +526,8 @@ append_record_forward(char *fpath, fileheader_t * record, int size, const char * strip_blank(address, address); if (get_num_records(fpath, sizeof(fileheader_t)) > MAX_KEEPMAIL_HARDLIMIT) { + unlink(buf); + // TODO add a mail so that origid knows what happened. #ifdef USE_LOG_INTERNETMAIL log_filef("log/internet_mail.log", LOG_CREAT, "%s [%s] (%s -> %s) mailbox overflow (%d > %d)\n", -- cgit v1.2.3