Fix RCON build error by adding _GNU_SOURCE for inet_aton

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
This commit is contained in:
Florian Kinder
2025-08-13 22:10:31 +09:00
parent 15bc6ef848
commit 4f551b4215

View File

@@ -1,3 +1,4 @@
#define _GNU_SOURCE
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
@@ -107,7 +108,8 @@ char* read_password(const char* conf_dir) {
fseek(fptr, 0, SEEK_SET); /* same as rewind(f); */
char *password = malloc(fsize + 1);
fread(password, fsize, 1, fptr);
size_t bytes_read = fread(password, fsize, 1, fptr);
(void)bytes_read; // Suppress unused warning
fclose(fptr);
password[fsize] = 0;