Added missing header for struct stat.

This commit is contained in:
Gerardo O 2025-03-30 19:17:06 -05:00
parent 869c0310bd
commit b58b43edef

View File

@ -39,6 +39,7 @@
#include <string.h> #include <string.h>
#include <getopt.h> #include <getopt.h>
#include <errno.h> #include <errno.h>
#include <sys/stat.h>
#ifdef HAVE_LIBGEOIP #ifdef HAVE_LIBGEOIP
#include <GeoIP.h> #include <GeoIP.h>
@ -977,10 +978,8 @@ parse_long_opt (const char *name, const char *oarg) {
if (!strcmp("db-path", name)) { if (!strcmp("db-path", name)) {
struct stat st; struct stat st;
// Check if the directory exists and is accessible // Check if the directory exists and is accessible
if (stat(oarg, &st) != 0 || !S_ISDIR(st.st_mode)) { if (stat(oarg, &st) != 0 || !S_ISDIR(st.st_mode))
perror("Database path does not exist or is not a directory"); FATAL("Database path does not exist or is not a directory");
return -1; // Return error or handle as appropriate
}
conf.db_path = oarg; conf.db_path = oarg;
} }