/dev/console may not be writable in Syslog.pm (from Ask Bjoern Hansen
Gurusamy Sarathy [Fri, 3 Mar 2000 16:26:52 +0000 (16:26 +0000)]
<ask@valueclick.com>)

p4raw-id: //depot/perl@5489

ext/Sys/Syslog/Syslog.pm

index b447374..17ebb37 100644 (file)
@@ -242,10 +242,11 @@ sub syslog {
                }
            }
            else {
-               open(CONS,">/dev/console");
-               print CONS "<$facility.$priority>$whoami: $message\r";
-               exit if defined $pid;           # if fork failed, we're parent
-               close CONS;
+               if (open(CONS,">/dev/console")) {
+                   print CONS "<$facility.$priority>$whoami: $message\r";
+                   exit if defined $pid;               # if fork failed, we're parent
+                   close CONS;
+               }
            }
        }
     }