Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable all warnings and pedantic mode #78

Merged
merged 4 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ GZIP ?= gzip -9 -n
DIFFOSCOPE ?= diffoscope
STRIP ?= strip

CFLAGS ?= -O3
CFLAGS ?= -O3 -Wall -Wextra -pedantic
ifeq ($(DEBUG),1)
CFLAGS += -g
endif
Expand Down
2 changes: 1 addition & 1 deletion cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static void print_usage(const char *argv0) {
printf("version: " VERSION "\n");
}

static void print_version() { puts(VERSION); }
static void print_version(void) { puts(VERSION); }

enum {
CLI_OPT_SOCKET_GROUP = CHAR_MAX + 1,
Expand Down
7 changes: 4 additions & 3 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,9 @@ static void _on_vmnet_packets_available(interface_ref iface, int64_t buf_count,
for (int i = 0; i < received_count; i++) {
uint8_t dest_mac[6], src_mac[6];
assert(pdv[i].vm_pkt_iov[0].iov_len > 12);
memcpy(dest_mac, pdv[i].vm_pkt_iov[0].iov_base, sizeof(dest_mac));
memcpy(src_mac, pdv[i].vm_pkt_iov[0].iov_base + 6, sizeof(src_mac));
const char *packet = (const char *)pdv[i].vm_pkt_iov[0].iov_base;
memcpy(dest_mac, packet, sizeof(dest_mac));
memcpy(src_mac, packet + 6, sizeof(src_mac));
DEBUGF("[Handler i=%d] Dest %02X:%02X:%02X:%02X:%02X:%02X, Src "
"%02X:%02X:%02X:%02X:%02X:%02X,",
i, dest_mac[0], dest_mac[1], dest_mac[2], dest_mac[3], dest_mac[4],
Expand Down Expand Up @@ -452,7 +453,7 @@ int main(int argc, char *argv[]) {
if (iface != NULL) {
stop(&state, iface);
}
if (listen >= 0) {
if (listen_fd != -1) {
close(listen_fd);
}
if (pid_fd != -1) {
Expand Down
Loading