summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2017-10-03 10:58:00 -0700
committerKarolin Seeger <kseeger@samba.org>2017-10-25 08:43:04 +0200
commit7d36ecb7e4793935daa01ac169a5ba749d73729e (patch)
treee4f365c06a0eced5b00d768fd2699d1534a36d74 /source3/lib
parent6b1971fe39cc91ae450d28238fe3f81758d0e6fd (diff)
downloadsamba-7d36ecb7e4793935daa01ac169a5ba749d73729e.tar.gz
s3: VFS: Protect errno if sys_getwd() fails across free() call.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13069 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> (cherry picked from commit 4800ed3595513ce1e2f4edee36c35daafc63a3d5)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/system.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/source3/lib/system.c b/source3/lib/system.c
index 01c934277ac..01473190147 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -594,7 +594,9 @@ char *sys_getwd(void)
break;
}
if (errno != ERANGE) {
+ int saved_errno = errno;
SAFE_FREE(s);
+ errno = saved_errno;
break;
}
allocated *= 2;
@@ -612,7 +614,9 @@ char *sys_getwd(void)
}
wd = getwd(s);
if (wd == NULL) {
+ int saved_errno = errno;
SAFE_FREE(s);
+ errno = saved_errno;
}
return wd;
#endif