summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2014-04-04 19:07:37 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2014-04-04 19:07:37 -0400
commit2209c0f8618bbed257975055e017efab139e3fa3 (patch)
tree08fcd6f237671add64019873acfdf7c7d09ee013 /src
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.
Diffstat (limited to 'src')
-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 438b5296042..3484f2cb615 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