summaryrefslogtreecommitdiff
path: root/source3/smbd/filename.c
diff options
context:
space:
mode:
authorAnand Avati <avati@redhat.com>2013-04-29 15:21:00 -0700
committerVolker Lendecke <vl@samba.org>2013-04-30 11:00:11 +0200
commit7e807934e6550308efed814a20ce6d6dabbad557 (patch)
tree2981e727eafed4696f8d73eca9b661c6b0559054 /source3/smbd/filename.c
parentc672ef11b1ed663b6366f321d3628acf05b3d0fe (diff)
downloadsamba-7e807934e6550308efed814a20ce6d6dabbad557.tar.gz
samba-7e807934e6550308efed814a20ce6d6dabbad557.tar.bz2
samba-7e807934e6550308efed814a20ce6d6dabbad557.zip
check_parent_exists() can change errno. Ensure we preserve it across calls.
Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Tue Apr 30 11:00:11 CEST 2013 on sn-devel-104
Diffstat (limited to 'source3/smbd/filename.c')
-rw-r--r--source3/smbd/filename.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c
index efa39f4119..03e1d2dfa1 100644
--- a/source3/smbd/filename.c
+++ b/source3/smbd/filename.c
@@ -450,13 +450,17 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
if (errno == ENOENT) {
/* Optimization when creating a new file - only
- the last component doesn't exist. */
+ the last component doesn't exist.
+ NOTE : check_parent_exists() doesn't preserve errno.
+ */
+ int saved_errno = errno;
status = check_parent_exists(ctx,
conn,
posix_pathnames,
smb_fname,
&dirpath,
&start);
+ errno = saved_errno;
if (!NT_STATUS_IS_OK(status)) {
goto fail;
}
@@ -529,13 +533,16 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
* Optimization for common case where the wildcard
* is in the last component and the client already
* sent the correct case.
+ * NOTE : check_parent_exists() doesn't preserve errno.
*/
+ int saved_errno = errno;
status = check_parent_exists(ctx,
conn,
posix_pathnames,
smb_fname,
&dirpath,
&start);
+ errno = saved_errno;
if (!NT_STATUS_IS_OK(status)) {
goto fail;
}