summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2006-03-30 02:10:46 +0800
committerkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2006-03-30 02:10:46 +0800
commit4380c093669fd69cd35a3ce02bc883aac0523bb5 (patch)
tree80743f514cb6dfb3e420dac5b88a5cd6be008a41
parentfd8c79217d534ad45ac189b9f78ad49157dd24b1 (diff)
downloadpttbbs-4380c093669fd69cd35a3ce02bc883aac0523bb5.tar
pttbbs-4380c093669fd69cd35a3ce02bc883aac0523bb5.tar.gz
pttbbs-4380c093669fd69cd35a3ce02bc883aac0523bb5.tar.bz2
pttbbs-4380c093669fd69cd35a3ce02bc883aac0523bb5.tar.lz
pttbbs-4380c093669fd69cd35a3ce02bc883aac0523bb5.tar.xz
pttbbs-4380c093669fd69cd35a3ce02bc883aac0523bb5.tar.zst
pttbbs-4380c093669fd69cd35a3ce02bc883aac0523bb5.zip
handle if process error
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3313 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/mbbsd.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index 5ce3af8a..31369b04 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -558,6 +558,7 @@ multi_user_check(void)
if (genbuf[0] != 'n') {
// race condition here, sleep may help..?
+ srandom(getpid());
usleep(random()%1000000+100000); // 0.1~1.1s
do {
// scan again, old ui may be invalid
@@ -565,7 +566,8 @@ multi_user_check(void)
if(ui==NULL)
return;
if (ui->pid > 0) {
- kill(ui->pid, SIGHUP);
+ if(kill(ui->pid, SIGHUP)<0)
+ break;
log_usies("KICK ", cuser.nickname);
} else {
fprintf(stderr, "id=%s ui->pid=0\n", cuser.userid);