From a2a8dc515cca833c442cc3bb4cf90682e8ba147d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 16 Nov 2009 14:55:21 -0800 Subject: Don't overwrite a dynamic pointer with the address of a stack variable. Jeremy. --- source3/smbd/fileio.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'source3/smbd/fileio.c') diff --git a/source3/smbd/fileio.c b/source3/smbd/fileio.c index c0deaebcfc..1c27fef09b 100644 --- a/source3/smbd/fileio.c +++ b/source3/smbd/fileio.c @@ -982,17 +982,15 @@ NTSTATUS sync_file(connection_struct *conn, files_struct *fsp, bool write_throug Perform a stat whether a valid fd or not. ************************************************************/ -int fsp_stat(files_struct *fsp, SMB_STRUCT_STAT *pst) +int fsp_stat(files_struct *fsp) { if (fsp->fh->fd == -1) { - int ret; - - ret = SMB_VFS_STAT(fsp->conn, fsp->fsp_name); - if (ret != -1) { - *pst = fsp->fsp_name->st; + if (fsp->posix_open) { + return SMB_VFS_LSTAT(fsp->conn, fsp->fsp_name); + } else { + return SMB_VFS_STAT(fsp->conn, fsp->fsp_name); } - return ret; } else { - return SMB_VFS_FSTAT(fsp, pst); + return SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st); } } -- cgit