s3: replace fsp_stat() with vfs_stat_fsp()
[bbaumbach/samba-autobuild/.git] / source3 / smbd / reply.c
index 4446d927aeb94b4241470be0e0bc086299ad2354..dcd46dd574c0bfb109311c708736c51766045093 100644 (file)
@@ -3764,6 +3764,7 @@ void reply_readbraw(struct smb_request *req)
        files_struct *fsp;
        struct lock_struct lock;
        off_t size = 0;
+       NTSTATUS status;
 
        START_PROFILE(SMBreadbraw);
 
@@ -3861,7 +3862,8 @@ void reply_readbraw(struct smb_request *req)
                return;
        }
 
-       if (fsp_stat(fsp) == 0) {
+       status = vfs_stat_fsp(fsp);
+       if (NT_STATUS_IS_OK(status)) {
                size = fsp->fsp_name->st.st_ex_size;
        }
 
@@ -4192,6 +4194,7 @@ static void send_file_readX(connection_struct *conn, struct smb_request *req,
        ssize_t nread = -1;
        struct lock_struct lock;
        int saved_errno = 0;
+       NTSTATUS status;
 
        init_strict_lock_struct(fsp, (uint64_t)req->smbpid,
            (uint64_t)startpos, (uint64_t)smb_maxcnt, READ_LOCK,
@@ -4216,8 +4219,9 @@ static void send_file_readX(connection_struct *conn, struct smb_request *req,
                uint8_t headerbuf[smb_size + 12 * 2 + 1 /* padding byte */];
                DATA_BLOB header;
 
-               if(fsp_stat(fsp) == -1) {
-                       reply_nterror(req, map_nt_error_from_unix(errno));
+               status = vfs_stat_fsp(fsp);
+               if (!NT_STATUS_IS_OK(status)) {
+                       reply_nterror(req, status);
                        goto out;
                }
 
@@ -5425,6 +5429,7 @@ void reply_lseek(struct smb_request *req)
        off_t res= -1;
        int mode,umode;
        files_struct *fsp;
+       NTSTATUS status;
 
        START_PROFILE(SMBlseek);
 
@@ -5469,9 +5474,9 @@ void reply_lseek(struct smb_request *req)
                        if(errno == EINVAL) {
                                off_t current_pos = startpos;
 
-                               if(fsp_stat(fsp) == -1) {
-                                       reply_nterror(req,
-                                               map_nt_error_from_unix(errno));
+                               status = vfs_stat_fsp(fsp);
+                               if (!NT_STATUS_IS_OK(status)) {
+                                       reply_nterror(req, status);
                                        END_PROFILE(SMBlseek);
                                        return;
                                }
@@ -8856,6 +8861,7 @@ void reply_getattrE(struct smb_request *req)
        int mode;
        files_struct *fsp;
        struct timespec create_ts;
+       NTSTATUS status;
 
        START_PROFILE(SMBgetattrE);
 
@@ -8874,8 +8880,9 @@ void reply_getattrE(struct smb_request *req)
        }
 
        /* Do an fstat on this file */
-       if(fsp_stat(fsp)) {
-               reply_nterror(req, map_nt_error_from_unix(errno));
+       status = vfs_stat_fsp(fsp);
+       if (!NT_STATUS_IS_OK(status)) {
+               reply_nterror(req, status);
                END_PROFILE(SMBgetattrE);
                return;
        }