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

redpantyhose
 2005-12-08 16:05
#60813 #60813
User since
2005-12-08
12 Artikel
BenutzerIn
[default_avatar]
Code: (dl )
Sehr wahrscheinlich hier ???  -->>  open (IFCONFIG, "$ifconfig $ethif 2>&1 |") || die ("ERROR (gen2nfs_sub_ifconfig_ipv4): $! $_");


Folgendes funktioniert (MAC-Adresse mit ifconfig herauskitzeln):

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
sub gen2nfs_sub_ifconfig_mac {

my $ethif = shift;
my $ifconfig = "$IFCONFIG";
my $string = 'HWaddr';
local *IFCONFIG;

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

while(<IFCONFIG>) {

# search MAC 00:00:00:00:00:00
# ww:ww:ww:ww:ww:ww
# \w = word

if ( /^.*$string\s(\w\w:\w\w:\w\w:\w\w:\w\w:\w\w)/ ) {
return "$1";
last;
} else {
die ("ERROR (gen2nfs_sub_ifconfig_mac): $! $_" );
};
}

close (IFCONFIG);
}

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