summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-04-18 13:49:40 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-04-18 13:49:40 +0800
commitc77c6cf22be895bb34192df420a9a141fe4a9d2c (patch)
treeffbb5a3bc61d8d8a181853ffceacb2eb7f8c59a0 /util
parent18f83795218bf3ea80255e9e84781ffa306921c5 (diff)
downloadpttbbs-c77c6cf22be895bb34192df420a9a141fe4a9d2c.tar
pttbbs-c77c6cf22be895bb34192df420a9a141fe4a9d2c.tar.gz
pttbbs-c77c6cf22be895bb34192df420a9a141fe4a9d2c.tar.bz2
pttbbs-c77c6cf22be895bb34192df420a9a141fe4a9d2c.tar.lz
pttbbs-c77c6cf22be895bb34192df420a9a141fe4a9d2c.tar.xz
pttbbs-c77c6cf22be895bb34192df420a9a141fe4a9d2c.tar.zst
pttbbs-c77c6cf22be895bb34192df420a9a141fe4a9d2c.zip
- xchat: fix "waterball exists forever" issue, and prevent printing mail alerts all the time.
- visio: improve history navigation ordering git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4187 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'util')
-rw-r--r--util/xchatd.c61
1 files changed, 6 insertions, 55 deletions
diff --git a/util/xchatd.c b/util/xchatd.c
index c9abac2e..fb339e4d 100644
--- a/util/xchatd.c
+++ b/util/xchatd.c
@@ -2635,7 +2635,6 @@ start_daemon()
{
int fd, value;
char buf[80];
- struct sockaddr_in fsin;
struct linger ld;
struct rlimit limit;
time_t dummy;
@@ -2690,22 +2689,6 @@ start_daemon()
limit.rlim_cur = limit.rlim_max;
setrlimit(RLIMIT_NOFILE, &limit);
-#if 0
- while (fd)
- {
- close(--fd);
- }
-
- value = getpid();
- setpgrp(0, value);
-
- if ((fd = open("/dev/tty", O_RDWR)) >= 0)
- {
- ioctl(fd, TIOCNOTTY, 0); /* Thor : 為什麼還要用 tty? */
- close(fd);
- }
-#endif
-
fd = open(CHAT_PIDFILE, O_WRONLY | O_CREAT | O_TRUNC, 0600);
if (fd >= 0)
{
@@ -2715,47 +2698,15 @@ start_daemon()
close(fd);
}
-#if 0
- /* ------------------------------ */
- /* trap signals */
- /* ------------------------------ */
-
- for (fd = 1; fd < NSIG; fd++)
- {
-
- Signal(fd, SIG_IGN);
- }
-#endif
-
- fd = socket(PF_INET, SOCK_STREAM, 0);
-
-#if 0
- value = fcntl(fd, F_GETFL, 0);
- fcntl(fd, F_SETFL, value | O_NDELAY);
-#endif
-
value = 1;
- setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *) &value, sizeof(value));
-
-#if 0
- setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (char *) &value, sizeof(value));
-
- value = 81920;
- setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char *) &value, sizeof(value));
-#endif
+ fd = tobind(XCHATD_ADDR);
ld.l_onoff = ld.l_linger = 0;
- setsockopt(fd, SOL_SOCKET, SO_LINGER, (char *) &ld, sizeof(ld));
-
- memset((char *) &fsin, 0, sizeof(fsin));
- fsin.sin_family = AF_INET;
- fsin.sin_port = htons(NEW_CHATPORT);
- fsin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
-
- if (bind(fd, (struct sockaddr *) & fsin, sizeof(fsin)) < 0)
- exit(1);
-
- listen(fd, SOCK_QLEN);
+ if (setsockopt(fd, SOL_SOCKET, SO_LINGER, (char *) &ld, sizeof(ld)) == -1)
+ {
+ perror("setsockopt");
+ exit(-1);
+ }
return fd;
}