diff options
author | ivan <ivan> | 2002-04-17 07:32:51 +0000 |
---|---|---|
committer | ivan <ivan> | 2002-04-17 07:32:51 +0000 |
commit | e6731f2dd2d04b93ef310922a71ff84f6df43fb6 (patch) | |
tree | 2b35a8c16a154f7c38f2462ab155adb3f6b18b17 | |
parent | f49abe45eac46eb04adbe18696a941993d5e9757 (diff) |
also don't leak processes, like fs_passwdd
-rwxr-xr-x | fs_signup/FS-SignupClient/fs_signupd | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/fs_signup/FS-SignupClient/fs_signupd b/fs_signup/FS-SignupClient/fs_signupd index e764f32b7..85bd68a2f 100755 --- a/fs_signup/FS-SignupClient/fs_signupd +++ b/fs_signup/FS-SignupClient/fs_signupd @@ -13,7 +13,8 @@ use vars qw( $Debug ); $Debug = 1; -my($fs_signupd_socket)="/usr/local/freeside/fs_signupd_socket"; +my $fs_signupd_socket = "/usr/local/freeside/fs_signupd_socket"; +my $pid_file = "$fs_signupd_socket.pid"; $ENV{'PATH'} ='/usr/local/bin:/usr/bin:/usr/ucb:/bin'; $ENV{'SHELL'} = '/bin/sh'; @@ -35,6 +36,18 @@ unlink($fs_signupd_socket); bind(Server, $uaddr) or die "bind: $!"; listen(Server,SOMAXCONN) or die "listen: $!"; +if ( -e $pid_file ) { + open(PIDFILE,"<$pid_file"); + #chomp( my $old_pid = <PIDFILE> ); + my $old_pid = <PIDFILE>; + close PIDFILE; + $old_pid =~ /^(\d+)$/; + kill 'TERM', $1; +} +open(PIDFILE,">$pid_file"); +print PIDFILE "$$\n"; +close PIDFILE; + warn "[fs_signupd] Entering main loop...\n" if $Debug; my $paddr; for ( ; $paddr = accept(Client,Server); close Client) { |