s3: Slightly simplify reply_close()
authorVolker Lendecke <vl@samba.org>
Tue, 17 Jul 2012 19:52:13 +0000 (21:52 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 18 Jul 2012 22:54:04 +0000 (15:54 -0700)
Signed-off-by: Jeremy Allison <jra@samba.org>
source3/smbd/reply.c

index 03af4ac403591c7c54844badf359db056ab91986..954938cbe30a96e16d6fd35c83fdbb7c8270dffc 100644 (file)
@@ -4812,10 +4812,6 @@ void reply_exit(struct smb_request *req)
        return;
 }
 
-/****************************************************************************
- Reply to a close - has to deal with closing a directory opened by NT SMB's.
-****************************************************************************/
-
 void reply_close(struct smb_request *req)
 {
        connection_struct *conn = req->conn;
@@ -4841,21 +4837,13 @@ void reply_close(struct smb_request *req)
                return;
        }
 
-       if(fsp->is_directory) {
-               /*
-                * Special case - close NT SMB directory handle.
-                */
-               DEBUG(3,("close directory %s\n", fsp_fnum_dbg(fsp)));
-               status = close_file(req, fsp, NORMAL_CLOSE);
-       } else {
-               time_t t;
-               /*
-                * Close ordinary file.
-                */
+       DEBUG(3, ("Close %s fd=%d %s (numopen=%d)\n",
+                 fsp->is_directory ? "directory" : "file",
+                 fsp->fh->fd, fsp_fnum_dbg(fsp),
+                 conn->num_files_open));
 
-               DEBUG(3,("close fd=%d %s (numopen=%d)\n",
-                        fsp->fh->fd, fsp_fnum_dbg(fsp),
-                        conn->num_files_open));
+       if (!fsp->is_directory) {
+               time_t t;
 
                /*
                 * Take care of any time sent in the close.
@@ -4863,15 +4851,15 @@ void reply_close(struct smb_request *req)
 
                t = srv_make_unix_date3(req->vwv+1);
                set_close_write_time(fsp, convert_time_t_to_timespec(t));
+       }
 
-               /*
-                * close_file() returns the unix errno if an error
-                * was detected on close - normally this is due to
-                * a disk full error. If not then it was probably an I/O error.
-                */
+       /*
+        * close_file() returns the unix errno if an error was detected on
+        * close - normally this is due to a disk full error. If not then it
+        * was probably an I/O error.
+        */
 
-               status = close_file(req, fsp, NORMAL_CLOSE);
-       }  
+       status = close_file(req, fsp, NORMAL_CLOSE);
 
        if (!NT_STATUS_IS_OK(status)) {
                reply_nterror(req, status);