mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-04 08:36:12 +00:00
arp: Preserve error if only the first ioctl fails
This commit is contained in:
parent
f7daf04f81
commit
203ee58aa2
Notes:
sideshowbarker
2024-07-18 02:47:13 +09:00
Author: https://github.com/BenWiederhake
Commit: 203ee58aa2
Pull-request: https://github.com/SerenityOS/serenity/pull/10443
Reviewed-by: https://github.com/alimpfard
1 changed files with 6 additions and 3 deletions
|
@ -156,11 +156,14 @@ int main(int argc, char** argv)
|
|||
|
||||
*(MACAddress*)&arp_req.arp_ha.sa_data[0] = hw_address.value();
|
||||
|
||||
int rc;
|
||||
int rc = 0;
|
||||
if (flag_set)
|
||||
rc = ioctl(fd, SIOCSARP, &arp_req);
|
||||
if (flag_delete)
|
||||
rc = ioctl(fd, SIOCDARP, &arp_req);
|
||||
if (flag_delete) {
|
||||
int rc2 = ioctl(fd, SIOCDARP, &arp_req);
|
||||
if (!rc2)
|
||||
rc = rc2;
|
||||
}
|
||||
|
||||
if (rc < 0) {
|
||||
perror("ioctl");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue