Handle hostnames with upper-case letters
[webmin.git] / changepass.pl
index f623ccf..3aa5346 100755 (executable)
@@ -50,11 +50,20 @@ foreach $v (values %users) {
 close(USERS);
 print "Updated password of Webmin user $user\n";
 
-# Send a signal to restart miniserv, if running
+# Send a signal to have miniserv reload it's config
 if (open(PID, $config{'pidfile'})) {
-       <PID> =~ /(\d+)/; $pid = $1;
+       $pid = <PID>;
+       $pid =~ s/\r|\n//;
        close(PID);
-       kill('HUP', $pid);
+       if (!$pid) {
+               print STDERR "Webmin is not running - cannot refresh configuration\n";
+               }
+       elsif (!kill('USR1', $pid)) {
+               print STDERR "Failed to signal process $pid - cannot refresh configuration\n";
+               }
+       }
+else {
+       print STDERR "Webmin is not running - cannot refresh configuration\n";
        }
 
 sub usage