Use access() instead of stat()

Since we do not care about anything other than that the directory exists
we may as well use access() rather than stat().
pull/238/head
Andreas Karlsson 3 months ago committed by Andreas Karlsson
parent ed1efc51ec
commit f36b906e14
  1. 6
      contrib/pg_tde/src/pg_tde.c

@ -5,8 +5,6 @@
#include "postgres.h"
#include <sys/stat.h>
#include "access/tableam.h"
#include "access/xlog.h"
#include "access/xloginsert.h"
@ -141,9 +139,7 @@ extension_install_redo(XLogExtensionInstall *xlrec)
static void
pg_tde_init_data_dir(void)
{
struct stat st;
if (stat(PG_TDE_DATA_DIR, &st) < 0)
if (access(PG_TDE_DATA_DIR, F_OK) == -1)
{
if (MakePGDirectory(PG_TDE_DATA_DIR) < 0)
ereport(ERROR,

Loading…
Cancel
Save