diff options
Diffstat (limited to 'src/common/pgfnames.c')
-rw-r--r-- | src/common/pgfnames.c | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/src/common/pgfnames.c b/src/common/pgfnames.c index f9e0a69be04..95b17e47d89 100644 --- a/src/common/pgfnames.c +++ b/src/common/pgfnames.c @@ -20,6 +20,12 @@ #include <dirent.h> +#ifndef FRONTEND +#define pg_log_warning(...) elog(WARNING, __VA_ARGS__) +#else +#include "fe_utils/logging.h" +#endif + /* * pgfnames * @@ -39,12 +45,7 @@ pgfnames(const char *path) dir = opendir(path); if (dir == NULL) { -#ifndef FRONTEND - elog(WARNING, "could not open directory \"%s\": %m", path); -#else - fprintf(stderr, _("could not open directory \"%s\": %s\n"), - path, strerror(errno)); -#endif + pg_log_warning("could not open directory \"%s\": %m", path); return NULL; } @@ -65,26 +66,12 @@ pgfnames(const char *path) } if (errno) - { -#ifndef FRONTEND - elog(WARNING, "could not read directory \"%s\": %m", path); -#else - fprintf(stderr, _("could not read directory \"%s\": %s\n"), - path, strerror(errno)); -#endif - } + pg_log_warning("could not read directory \"%s\": %m", path); filenames[numnames] = NULL; if (closedir(dir)) - { -#ifndef FRONTEND - elog(WARNING, "could not close directory \"%s\": %m", path); -#else - fprintf(stderr, _("could not close directory \"%s\": %s\n"), - path, strerror(errno)); -#endif - } + pg_log_warning("could not close directory \"%s\": %m", path); return filenames; } |