vfs_fileid: preserve errno in an error code path
authorRalph Boehme <slow@samba.org>
Fri, 5 Jan 2018 09:23:30 +0000 (10:23 +0100)
committerJeremy Allison <jra@samba.org>
Fri, 5 Jan 2018 23:07:17 +0000 (00:07 +0100)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/modules/vfs_fileid.c

index 9a8f3f99193d0b26cd0f1138cd9bc4191e258035..fedcac7e6d560c4b4e4252552f8150be7be566a0 100644 (file)
@@ -183,6 +183,7 @@ static int fileid_connect(struct vfs_handle_struct *handle,
 {
        struct fileid_handle_data *data;
        const char *algorithm;
+       int saved_errno;
        int ret = SMB_VFS_NEXT_CONNECT(handle, service, user);
 
        if (ret < 0) {
@@ -191,8 +192,10 @@ static int fileid_connect(struct vfs_handle_struct *handle,
 
        data = talloc_zero(handle->conn, struct fileid_handle_data);
        if (!data) {
+               saved_errno = errno;
                SMB_VFS_NEXT_DISCONNECT(handle);
                DEBUG(0, ("talloc_zero() failed\n"));
+               errno = saved_errno;
                return -1;
        }