Skip to content

Commit 19ca8d8

Browse files
authored
Fix RCON build error by adding _GNU_SOURCE for inet_aton (#583)
The build was failing with 'implicit declaration of function inet_aton' error in newer GCC versions. Adding _GNU_SOURCE feature test macro makes inet_aton available. Also fixed unused result warning for fread. Fixes #582
1 parent 15bc6ef commit 19ca8d8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

docker/rcon/main.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#define _GNU_SOURCE
12
#include <stdio.h>
23
#include <stdint.h>
34
#include <stdbool.h>
@@ -107,7 +108,8 @@ char* read_password(const char* conf_dir) {
107108
fseek(fptr, 0, SEEK_SET); /* same as rewind(f); */
108109

109110
char *password = malloc(fsize + 1);
110-
fread(password, fsize, 1, fptr);
111+
size_t bytes_read = fread(password, fsize, 1, fptr);
112+
(void)bytes_read; // Suppress unused warning
111113
fclose(fptr);
112114

113115
password[fsize] = 0;

0 commit comments

Comments
 (0)