summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2014-04-04 23:07:37 +0000
committerTom Lane2014-04-04 23:07:37 +0000
commit2209c0f8618bbed257975055e017efab139e3fa3 (patch)
tree08fcd6f237671add64019873acfdf7c7d09ee013
parent9aca51250681d2e8d18ed1d73e7cd1283d1cf303 (diff)
Preserve errno across free().
Dept. of second thoughts: free() isn't guaranteed not to change errno. Make sure we report the right error if getcwd() fails.
-rw-r--r--src/port/path.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/port/path.c b/src/port/path.c
index 438b529604..3484f2cb61 100644
--- a/src/port/path.c
+++ b/src/port/path.c
@@ -608,7 +608,10 @@ make_absolute_path(const char *path)
}
else
{
+ int save_errno = errno;
+
free(buf);
+ errno = save_errno;
#ifndef FRONTEND
elog(ERROR, "could not get current working directory: %m");
#else