Skip to content

Commit 20c338d

Browse files
authored
Merge pull request #78 from nirs/warnings
Enable all warnings and pedantic mode
2 parents d7aba7a + 3adaad8 commit 20c338d

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ GZIP ?= gzip -9 -n
1313
DIFFOSCOPE ?= diffoscope
1414
STRIP ?= strip
1515

16-
CFLAGS ?= -O3
16+
CFLAGS ?= -O3 -Wall -Wextra -pedantic
1717
ifeq ($(DEBUG),1)
1818
CFLAGS += -g
1919
endif

cli.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static void print_usage(const char *argv0) {
6161
printf("version: " VERSION "\n");
6262
}
6363

64-
static void print_version() { puts(VERSION); }
64+
static void print_version(void) { puts(VERSION); }
6565

6666
enum {
6767
CLI_OPT_SOCKET_GROUP = CHAR_MAX + 1,

main.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,9 @@ static void _on_vmnet_packets_available(interface_ref iface, int64_t buf_count,
163163
for (int i = 0; i < received_count; i++) {
164164
uint8_t dest_mac[6], src_mac[6];
165165
assert(pdv[i].vm_pkt_iov[0].iov_len > 12);
166-
memcpy(dest_mac, pdv[i].vm_pkt_iov[0].iov_base, sizeof(dest_mac));
167-
memcpy(src_mac, pdv[i].vm_pkt_iov[0].iov_base + 6, sizeof(src_mac));
166+
const char *packet = (const char *)pdv[i].vm_pkt_iov[0].iov_base;
167+
memcpy(dest_mac, packet, sizeof(dest_mac));
168+
memcpy(src_mac, packet + 6, sizeof(src_mac));
168169
DEBUGF("[Handler i=%d] Dest %02X:%02X:%02X:%02X:%02X:%02X, Src "
169170
"%02X:%02X:%02X:%02X:%02X:%02X,",
170171
i, dest_mac[0], dest_mac[1], dest_mac[2], dest_mac[3], dest_mac[4],
@@ -452,7 +453,7 @@ int main(int argc, char *argv[]) {
452453
if (iface != NULL) {
453454
stop(&state, iface);
454455
}
455-
if (listen >= 0) {
456+
if (listen_fd != -1) {
456457
close(listen_fd);
457458
}
458459
if (pid_fd != -1) {

0 commit comments

Comments
 (0)