summaryrefslogtreecommitdiffstats
path: root/mbbsd/mail.c
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2006-05-08 19:02:35 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2006-05-08 19:02:35 +0800
commitf1a8a8052cf6d266b3a5c50fea8af0a9b4f7df59 (patch)
treee5c392589f2a088d21db560ebb0d5e2706aa7ec1 /mbbsd/mail.c
parent6c32f93fe41341609eef6e9938d6ad9aa675a763 (diff)
downloadpttbbs-f1a8a8052cf6d266b3a5c50fea8af0a9b4f7df59.tar
pttbbs-f1a8a8052cf6d266b3a5c50fea8af0a9b4f7df59.tar.gz
pttbbs-f1a8a8052cf6d266b3a5c50fea8af0a9b4f7df59.tar.bz2
pttbbs-f1a8a8052cf6d266b3a5c50fea8af0a9b4f7df59.tar.lz
pttbbs-f1a8a8052cf6d266b3a5c50fea8af0a9b4f7df59.tar.xz
pttbbs-f1a8a8052cf6d266b3a5c50fea8af0a9b4f7df59.tar.zst
pttbbs-f1a8a8052cf6d266b3a5c50fea8af0a9b4f7df59.zip
do not setuserfile if filename is empty
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3355 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/mail.c')
-rw-r--r--mbbsd/mail.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/mbbsd/mail.c b/mbbsd/mail.c
index 86c1124b..4c4f58d9 100644
--- a/mbbsd/mail.c
+++ b/mbbsd/mail.c
@@ -977,21 +977,22 @@ maildoent(int num, fileheader_t * ent)
char buf[MAXPATHLEN];
struct stat st;
- setuserfile(buf, ent->filename);
- if (stat(buf, &st) >= 0)
- {
- filesz = st.st_size;
- /* find printing unit */
- filesz = (filesz + 1023) / 1024;
- if(filesz > 9999)
- {
- filesz = (filesz+512) / 1024;
- ut = 'M';
- }
- if(filesz > 9999)
- {
- filesz = (filesz+512) / 1024;
- ut = 'G';
+ if( !ent->filename[0] ){
+ filesz = 0;
+ } else {
+ setuserfile(buf, ent->filename);
+ if (stat(buf, &st) >= 0) {
+ filesz = st.st_size;
+ /* find printing unit */
+ filesz = (filesz + 1023) / 1024;
+ if(filesz > 9999){
+ filesz = (filesz+512) / 1024;
+ ut = 'M';
+ }
+ if(filesz > 9999) {
+ filesz = (filesz+512) / 1024;
+ ut = 'G';
+ }
}
}
sprintf(datepart, "%4lu%c", (unsigned long)filesz, ut);