From 23012f4d382b1f4c4c9ba147ad98e572aa54aff3 Mon Sep 17 00:00:00 2001 From: Andreas Karlsson Date: Thu, 12 Jun 2025 13:57:39 +0200 Subject: [PATCH] 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(). --- contrib/pg_tde/src/pg_tde.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/contrib/pg_tde/src/pg_tde.c b/contrib/pg_tde/src/pg_tde.c index d7738ed869dac..626d5493b8fb3 100644 --- a/contrib/pg_tde/src/pg_tde.c +++ b/contrib/pg_tde/src/pg_tde.c @@ -5,8 +5,6 @@ #include "postgres.h" -#include - #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,