sap-vpn.pl
changeset 8 9f1f562a69a1
parent 7 f9fbeced9093
child 9 b8eabdc8e452
equal deleted inserted replaced
7:f9fbeced9093 8:9f1f562a69a1
   271 }
   271 }
   272 
   272 
   273 sub do_kill($) {
   273 sub do_kill($) {
   274     my $linkname = shift;
   274     my $linkname = shift;
   275     open((my $fh), $_ = "/var/run/ppp-$linkname.pid")
   275     open((my $fh), $_ = "/var/run/ppp-$linkname.pid")
   276 	or die ME . ": Can't open the link file \"$_\": $!\n";
   276       or die ME . ": Can't open the link file \"$_\": $!\n";
   277 
   277 
   278     my $pid   = <$fh>;
   278     my $pid   = <$fh>;
   279     my $iface = <$fh>;
   279     my $iface = <$fh>;
   280 
   280 
   281     map { chomp; untaint } $pid, $iface;
   281     map { chomp; untaint } $pid, $iface;
   282 
   282 
   283     # become root doesn't seem to be necessary, as long as our
   283     # become root doesn't seem to be necessary, as long as our
   284     # real uid is 0
   284     # real uid is 0
   285     kill 15, $pid or die ME . ": Can't kill pid $pid: $!\n";
   285     kill 15, $pid or die ME . ": Can't kill pid $pid: $!\n";
   286 
   286 
   287     waitpid $pid, 0 != -1 
   287     waitpid $pid, 0 != -1
   288 	or die ME . ": was not able to wait for the ppp process: $!\n";
   288       or die ME . ": was not able to wait for the ppp process: $!\n";
   289 
   289 
   290     verbose "% process killed, rc: @{[$? >> 8]}, sig: @{[$? & 0xff]}\n";
   290     verbose "% process killed, rc: "
       
   291       . ($? >> 8)
       
   292       . ", sig: "
       
   293       . ($? & 0xff) . "\n";
   291 }
   294 }
   292 
   295 
   293 __END__
   296 __END__
   294 
   297 
   295 =head1 SYNOPSIS
   298 =head1 SYNOPSIS