Skip to content

Commit 1a26e1c

Browse files
committed
Add strerror() string to chdir() error message
1 parent 21c09e9 commit 1a26e1c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/port/exec.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@
2626
#include <unistd.h>
2727

2828
#ifndef FRONTEND
29-
/* We use only 3-parameter elog calls in this file, for simplicity */
29+
/* We use only 3- and 4-parameter elog calls in this file, for simplicity */
3030
/* NOTE: caller must provide gettext call around str! */
3131
#define log_error(str, param) elog(LOG, str, param)
32+
#define log_error4(str, param, arg1) elog(LOG, str, param, arg1)
3233
#else
3334
#define log_error(str, param) (fprintf(stderr, str, param), fputc('\n', stderr))
35+
#define log_error4(str, param, arg1) (fprintf(stderr, str, param, arg1), fputc('\n', stderr))
3436
#endif
3537

3638
#ifdef WIN32_ONLY_COMPILER
@@ -252,7 +254,7 @@ resolve_symlinks(char *path)
252254
*lsep = '\0';
253255
if (chdir(path) == -1)
254256
{
255-
log_error(_("could not change directory to \"%s\""), path);
257+
log_error4(_("could not change directory to \"%s\": %s"), path, strerror(errno));
256258
return -1;
257259
}
258260
fname = lsep + 1;
@@ -288,7 +290,7 @@ resolve_symlinks(char *path)
288290

289291
if (chdir(orig_wd) == -1)
290292
{
291-
log_error(_("could not change directory to \"%s\""), orig_wd);
293+
log_error4(_("could not change directory to \"%s\": %s"), orig_wd, strerror(errno));
292294
return -1;
293295
}
294296
#endif /* HAVE_READLINK */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy