]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - config/cfgroot/modem-lib.pl
core130: update pakfire database after version change
[ipfire-2.x.git] / config / cfgroot / modem-lib.pl
index 51b6d68e9cd60837da13cbc1a9ee37723d038cd7..5d43cc176e7a103b46bfa1282be457351f8e278f 100644 (file)
@@ -33,7 +33,10 @@ sub new() {
        bless $self, $class;
 
        # Initialize the connetion to the modem.
-       $self->_initialize($port, $baud);
+       my $ret = $self->_initialize($port, $baud);
+       if ($ret) {
+               return undef;
+       }
 
        if ($self->_is_working()) {
                return $self;
@@ -54,9 +57,16 @@ sub DESTROY() {
 sub _initialize() {
        my ($self, $port, $baud) = @_;
 
+       # Check if the character device actually exists.
+       if (! -c $port) {
+               return 1;
+       }
+
        # Establish connection to the modem.
        $self->{modem} = new Device::Modem(port => $port);
        $self->{modem}->connect(baudrate => $baud);
+
+       return 0;
 }
 
 sub _is_working() {