summaryrefslogtreecommitdiffstats
path: root/mbbsd/record.c
diff options
context:
space:
mode:
authorptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2007-01-11 04:54:42 +0800
committerptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2007-01-11 04:54:42 +0800
commit3a682078f1139a4bf98bd6c45ebe7c4529c37fe1 (patch)
tree9d8bbf20dc6f505347ee4a1f396b3522b5539fd0 /mbbsd/record.c
parentc0ec6aa1cfa1ab6dc7db2453d68bb5b33c8d3644 (diff)
downloadpttbbs-3a682078f1139a4bf98bd6c45ebe7c4529c37fe1.tar
pttbbs-3a682078f1139a4bf98bd6c45ebe7c4529c37fe1.tar.gz
pttbbs-3a682078f1139a4bf98bd6c45ebe7c4529c37fe1.tar.bz2
pttbbs-3a682078f1139a4bf98bd6c45ebe7c4529c37fe1.tar.lz
pttbbs-3a682078f1139a4bf98bd6c45ebe7c4529c37fe1.tar.xz
pttbbs-3a682078f1139a4bf98bd6c45ebe7c4529c37fe1.tar.zst
pttbbs-3a682078f1139a4bf98bd6c45ebe7c4529c37fe1.zip
fix a bug on stamp file which does unnecessary memset sometimes.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3471 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/record.c')
-rw-r--r--mbbsd/record.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/mbbsd/record.c b/mbbsd/record.c
index 0015e7a4..7a2fc429 100644
--- a/mbbsd/record.c
+++ b/mbbsd/record.c
@@ -463,7 +463,9 @@ apply_record(const char *fpath, int (*fptr) (void *item, void *optarg), int size
/* mail / post 時,依據時間建立檔案,加上郵戳 */
int
-stampfile(char *fpath, fileheader_t * fh)
+stampfile_u(char *fpath, fileheader_t * fh)
+ // Ptt: stampfile_u: won't clear fileheader
+ // stampfile: will clear fileheader
{
register char *ip = fpath;
time4_t dtime = COMMON_TIME;
@@ -488,7 +490,6 @@ stampfile(char *fpath, fileheader_t * fh)
} while ((fp = open(fpath, O_CREAT | O_EXCL | O_WRONLY, 0644)) == -1);
close(fp);
#endif
- memset(fh, 0, sizeof(fileheader_t));
strlcpy(fh->filename, ip, sizeof(fh->filename));
ptime = localtime4(&dtime);
snprintf(fh->date, sizeof(fh->date),
@@ -496,6 +497,13 @@ stampfile(char *fpath, fileheader_t * fh)
return 0;
}
+inline int
+stampfile(char *fpath, fileheader_t * fh)
+{
+ memset(fh, 0, sizeof(fileheader_t));
+ return stampfile_u(fpath, fh);
+}
+
void
stampdir(char *fpath, fileheader_t * fh)
{