Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardobranco777 committed Feb 18, 2024
1 parent 7bbd5b2 commit 356211c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions wol.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@
static void
wake_on_lan(const char *mac_address) {
char payload[102];
int mac[6];
uint8_t mac[6];

sscanf(mac_address, "%2x%2x%2x%2x%2x%2x", &mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5]);
(void) sscanf(mac_address, "%2hhx%2hhx%2hhx%2hhx%2hhx%2hhx",
&mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5]);

memset(payload, 0xFF, 6);
for (unsigned int i = 6; i < sizeof(payload); i += 6)
memcpy(payload + i, mac, sizeof(mac));
memcpy(payload + i, mac, 6);

struct sockaddr_in sa;
sa.sin_family = AF_INET;
Expand Down Expand Up @@ -71,4 +72,3 @@ main(int argc, char *argv[]) {
regfree(&regex);
return (0);
}

0 comments on commit 356211c

Please sign in to comment.