Thread "Bad file descriptor" aber warum ??? (7 answers)
Opened by Gast at 2005-12-08 15:53

Gast Gast
 2005-12-08 15:53
#60811 #60811
Ich habe folgendes sub geschrieben zum finden einer IP mittels ifconfig :

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
sub gen2nfs_sub_ifconfig_ipv4 {

my $ethif = shift;
my $ifconfig = "$IFCONFIG";
my $string = 'inet\saddr:';
local *IFCONFIG;

open (IFCONFIG, "$ifconfig $ethif 2>&1 |") || die ("ERROR (gen2nfs_sub_ifconfig_ipv4): $! $_");

while(<IFCONFIG>) {

# search IP 123.123.123.123
# ddd.ddd.ddd.ddd
# \d = digit
# {1,3} 1,2 or 3 digits

if ( /^.*$string(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/ ) {
return "$1";
last;
} else {
die ("ERROR (gen2nfs_sub_ifconfig_ipv4): $! $_");
};
}

close (IFCONFIG);
}


Leider bricht das Programm mit "Bad file descriptor" ab.
Woran kann dies liegen ???

Herzlichen Dank

Denis

View full thread "Bad file descriptor" aber warum ???