Skip to content

Commit

Permalink
[#179] Check unix_socket_dir upon startup
Browse files Browse the repository at this point in the history
  • Loading branch information
jesperpedersen committed Oct 7, 2021
1 parent 0fd2924 commit 508cb90
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/libpgagroal/configuration.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include <string.h>
#include <strings.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#ifdef HAVE_LINUX
#include <systemd/sd-daemon.h>
Expand Down Expand Up @@ -833,6 +834,16 @@ pgagroal_validate_configuration(void* shm, bool has_unix_socket, bool has_main_s
pgagroal_log_fatal("pgagroal: No unix_socket_dir defined");
return 1;
}

if (stat(config->unix_socket_dir, &st) == 0 && S_ISDIR(st.st_mode))
{
/* Ok */
}
else
{
pgagroal_log_fatal("pgagroal: unix_socket_dir is not a directory (%s)", config->unix_socket_dir);
return 1;
}
}

if (config->backlog <= 0)
Expand Down

0 comments on commit 508cb90

Please sign in to comment.