mirror of
https://github.com/factoriotools/factorio-docker.git
synced 2025-10-08 23:09:48 +02:00
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:
@@ -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;
|
||||
|
Reference in New Issue
Block a user