summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorscw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-04-02 16:23:19 +0800
committerscw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-04-02 16:23:19 +0800
commiteb86d8ff553917f392c556ef3a4b846910b1a17a (patch)
tree31c589739ddd4ecd6f144790dafb6fea654685e6 /mbbsd
parent09d73f6f75cb15e6882403ef143705da4fee64bf (diff)
downloadpttbbs-eb86d8ff553917f392c556ef3a4b846910b1a17a.tar
pttbbs-eb86d8ff553917f392c556ef3a4b846910b1a17a.tar.gz
pttbbs-eb86d8ff553917f392c556ef3a4b846910b1a17a.tar.bz2
pttbbs-eb86d8ff553917f392c556ef3a4b846910b1a17a.tar.lz
pttbbs-eb86d8ff553917f392c556ef3a4b846910b1a17a.tar.xz
pttbbs-eb86d8ff553917f392c556ef3a4b846910b1a17a.tar.zst
pttbbs-eb86d8ff553917f392c556ef3a4b846910b1a17a.zip
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
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/chat.c5
-rw-r--r--mbbsd/chc.c4
-rw-r--r--mbbsd/edit.c12
-rw-r--r--mbbsd/register.c1
-rw-r--r--mbbsd/talk.c5
-rw-r--r--mbbsd/user.c5
6 files changed, 21 insertions, 11 deletions
diff --git a/mbbsd/chat.c b/mbbsd/chat.c
index 744efa7d..66238334 100644
--- a/mbbsd/chat.c
+++ b/mbbsd/chat.c
@@ -381,9 +381,8 @@ t_chat()
print_chatid(chatid);
memset(inbuf, 0, sizeof(inbuf));
- sethomepath(fpath, cuser->userid);
- strlcpy(fpath, tempnam(fpath, "chat_"), sizeof(fpath));
- flog = fopen(fpath, "w");
+ setuserfile(fpath, "chat_XXXXXX");
+ flog = fdopen(mkstemp(fpath), "w");
while (chatting) {
move(b_lines - 1, currchar + chatid_len);
diff --git a/mbbsd/chc.c b/mbbsd/chc.c
index e9f043fd..249b2d98 100644
--- a/mbbsd/chc.c
+++ b/mbbsd/chc.c
@@ -305,7 +305,11 @@ chc_log_step(board_t board, rc_t *from, rc_t *to)
}
static int
+#ifdef __linux__
+chc_filter(const struct dirent *dir)
+#else
chc_filter(struct dirent *dir)
+#endif
{
if (strcmp(dir->d_name, ".") == 0 || strcmp(dir->d_name, "..") == 0 )
return 0;
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);
}
diff --git a/mbbsd/register.c b/mbbsd/register.c
index 53de740e..04da1f05 100644
--- a/mbbsd/register.c
+++ b/mbbsd/register.c
@@ -1,5 +1,6 @@
/* $Id$ */
#define _XOPEN_SOURCE
+#define _ISOC99_SOURCE
#include "bbs.h"
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index c54291a2..8052ae5a 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -993,9 +993,8 @@ do_talk(int fd)
ptime = localtime(&now);
- sethomepath(fpath, cuser->userid);
- strlcpy(fpath, tempnam(fpath, "talk_"), sizeof(fpath));
- flog = fopen(fpath, "w");
+ setuserfile(fpath, "talk_XXXXXX");
+ flog = fdopen(mkstemp(fpath), "w");
setuserfile(genbuf, fn_talklog);
diff --git a/mbbsd/user.c b/mbbsd/user.c
index 98b6fac7..eb71a4ea 100644
--- a/mbbsd/user.c
+++ b/mbbsd/user.c
@@ -1,4 +1,7 @@
/* $Id$ */
+#define _XOPEN_SOURCE
+#define _ISOC99_SOURCE
+
#include "bbs.h"
static char *sex[8] = {
@@ -1436,7 +1439,7 @@ u_register(void)
/* 列出所有註冊使用者 */
static int usercounter, totalusers;
-static ushort u_list_special;
+static unsigned short u_list_special;
static int
u_list_CB(int num, userec_t * uentp)