[PATCH] vfstest: fix uninitialised variable usage in open
David Disseldorp
ddiss at samba.org
Fri Nov 8 05:56:23 MST 2013
The vfstest open command currently fails intermittently due to a read of
a potentially uninitialised status variable.
Signed-off-by: David Disseldorp <ddiss at samba.org>
---
source3/torture/cmd_vfs.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/source3/torture/cmd_vfs.c b/source3/torture/cmd_vfs.c
index 1b20208..f923ed5 100644
--- a/source3/torture/cmd_vfs.c
+++ b/source3/torture/cmd_vfs.c
@@ -347,6 +347,7 @@ static NTSTATUS cmd_open(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, c
return NT_STATUS_UNSUCCESSFUL;
}
+ status = NT_STATUS_OK;
ret = SMB_VFS_FSTAT(fsp, &smb_fname->st);
if (ret == -1) {
/* If we have an fd, this stat should succeed. */
@@ -359,7 +360,7 @@ static NTSTATUS cmd_open(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, c
errno = EISDIR;
status = NT_STATUS_FILE_IS_A_DIRECTORY;
}
-
+
if (!NT_STATUS_IS_OK(status)) {
SMB_VFS_CLOSE(fsp);
TALLOC_FREE(fsp);
@@ -1780,7 +1781,7 @@ struct cmd_set vfs_commands[] = {
{ "mkdir", cmd_mkdir, "VFS mkdir()", "mkdir <path>" },
{ "rmdir", cmd_pathfunc, "VFS rmdir()", "rmdir <path>" },
{ "closedir", cmd_closedir, "VFS closedir()", "closedir" },
- { "open", cmd_open, "VFS open()", "open <fname>" },
+ { "open", cmd_open, "VFS open()", "open <fname> <flags> <mode>" },
{ "close", cmd_close, "VFS close()", "close <fd>" },
{ "read", cmd_read, "VFS read()", "read <fd> <size>" },
{ "write", cmd_write, "VFS write()", "write <fd> <size>" },
--
1.8.1.4
More information about the samba-technical
mailing list