Exit with proper status when wake() fails.

PR:		bin/153527
Submitted by:	Douglas Steinwand
MFC after:	2 weeks
This commit is contained in:
Jaakko Heinonen 2012-02-24 07:54:08 +00:00
parent 6acc4f15d0
commit 06eb5e92e2

View File

@ -183,7 +183,7 @@ send_wakeup(int bpf, struct ether_addr const *addr)
int
main(int argc, char *argv[])
{
int bpf, n;
int bpf, n, rval;
char ifname[IF_NAMESIZE];
if (argc < 2)
@ -204,10 +204,13 @@ main(int argc, char *argv[])
if (n >= argc)
usage();
for (; n < argc; n++)
if (wake(bpf, argv[n]))
rval = 0;
for (; n < argc; n++) {
if (wake(bpf, argv[n]) != 0) {
rval = 1;
warn("Cannot send Wake on LAN frame over `%s' to `%s'",
ifname, argv[n]);
return (0);
}
}
exit(rval);
}