summaryrefslogtreecommitdiff
path: root/source3/smbd/open.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd/open.c')
-rw-r--r--source3/smbd/open.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 8c6e8ed805..29a854a397 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -87,7 +87,7 @@ static void check_for_pipe(char *fname)
****************************************************************************/
static BOOL open_file(files_struct *fsp,connection_struct *conn,
- const char *fname1,SMB_STRUCT_STAT *psbuf,int flags,mode_t mode, uint32 desired_access)
+ char *fname1,SMB_STRUCT_STAT *psbuf,int flags,mode_t mode, uint32 desired_access)
{
extern struct current_user current_user;
pstring fname;
@@ -169,15 +169,11 @@ static BOOL open_file(files_struct *fsp,connection_struct *conn,
if (fsp->fd == -1)
ret = vfs_stat(conn, fname, psbuf);
- else {
+ else
ret = vfs_fstat(fsp,fsp->fd,psbuf);
- /* If we have an fd, this stat should succeed. */
- if (ret == -1)
- DEBUG(0,("Error doing fstat on open file %s (%s)\n", fname,strerror(errno) ));
- }
- /* For a non-io open, this stat failing means file not found. JRA */
if (ret == -1) {
+ DEBUG(0,("Error doing fstat on open file %s (%s)\n", fname,strerror(errno) ));
fd_close(conn, fsp);
return False;
}
@@ -1050,7 +1046,7 @@ flags=0x%X flags2=0x%X mode=0%o returned %d\n",
Open a file for for write to ensure that we can fchmod it.
****************************************************************************/
-files_struct *open_file_fchmod(connection_struct *conn, const char *fname, SMB_STRUCT_STAT *psbuf)
+files_struct *open_file_fchmod(connection_struct *conn, char *fname, SMB_STRUCT_STAT *psbuf)
{
files_struct *fsp = NULL;
BOOL fsp_open;
@@ -1062,9 +1058,7 @@ files_struct *open_file_fchmod(connection_struct *conn, const char *fname, SMB_S
if(!fsp)
return NULL;
- /* note! we must use a non-zero desired access or we don't get
- a real file descriptor. Oh what a twisted web we weave. */
- fsp_open = open_file(fsp,conn,fname,psbuf,O_WRONLY,0,FILE_WRITE_DATA);
+ fsp_open = open_file(fsp,conn,fname,psbuf,O_WRONLY,0,0);
/*
* This is not a user visible file open.
@@ -1164,7 +1158,7 @@ files_struct *open_directory(connection_struct *conn, char *fname, SMB_STRUCT_ST
*/
if(!got_stat) {
- DEBUG(3,("open_directory: unable to stat name = %s. Error was %s\n",
+ DEBUG(0,("open_directory: unable to stat name = %s. Error was %s\n",
fname, strerror(errno) ));
file_free(fsp);
return NULL;