This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
/dev/console may not be writable in Syslog.pm (from Ask Bjoern Hansen
[perl5.git] / 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;
+               }
            }
        }
     }