From eb86d8ff553917f392c556ef3a4b846910b1a17a Mon Sep 17 00:00:00 2001 From: scw Date: Fri, 2 Apr 2004 08:23:19 +0000 Subject: Fix warning, including: Prototype differance of crypt() on linux. Adding _ISOC99_SOURCE to get declaration of snprintf() on linux. Including strings.h to get declaration of strcasecmp() on linux. Using mkstemp() instead of tempnam(). git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1679 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/edit.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'mbbsd/edit.c') diff --git a/mbbsd/edit.c b/mbbsd/edit.c index 8cd5ebc7..6b30ea4e 100644 --- a/mbbsd/edit.c +++ b/mbbsd/edit.c @@ -1000,14 +1000,18 @@ write_file(char *fpath, int saveheader, int *islocal) } if (!aborted) { + int tempfd; + if (saveheader && !(curredit & EDIT_MAIL) && check_quote()) return KEEP_EDITING; - if (!*fpath) { - sethomepath(fpath, cuser->userid); - strcpy(fpath, tempnam(fpath, "ve_")); + if (*fpath) { + tempfd = open(fpath, O_WRONLY | O_CREAT | O_TRUNC, 0600); + }else{ + setuserfile(fpath, "ve_XXXXXX"); + tempfd = mkstemp(fpath); } - if ((fp = fopen(fpath, "w")) == NULL) { + if ((fp = fdopen(tempfd, "w")) == NULL) { indigestion(5); abort_bbs(0); } -- cgit v1.2.3