Dmitry Timoshkov : server: Track separately implicit and explicit file disposition.

Alexandre Julliard julliard at winehq.org
Fri Nov 9 14:12:15 CST 2018


Module: wine
Branch: master
Commit: ee020079671fa88b4aceb9277448b2d79ce65798
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=ee020079671fa88b4aceb9277448b2d79ce65798

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Fri Nov  9 14:01:12 2018 +0300

server: Track separately implicit and explicit file disposition.

Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 server/fd.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/server/fd.c b/server/fd.c
index 246b758..f2d83b4 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -166,7 +166,7 @@ struct closed_fd
 {
     struct list entry;       /* entry in inode closed list */
     int         unix_fd;     /* the unix file descriptor */
-    int         unlink;      /* whether to unlink on close */
+    int         unlink;      /* whether to unlink on close: -1 - implicit FILE_DELETE_ON_CLOSE, 1 - explicit disposition */
     char       *unix_name;   /* name to unlink on close, points to parent fd unix_name */
 };
 
@@ -1869,7 +1869,7 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode,
             goto error;
         }
 
-        fd->closed->unlink = (options & FILE_DELETE_ON_CLOSE) != 0;
+        fd->closed->unlink = (options & FILE_DELETE_ON_CLOSE) ? -1 : 0;
         if (flags & O_TRUNC)
         {
             if (S_ISDIR(st.st_mode))
@@ -2314,7 +2314,9 @@ static void set_fd_disposition( struct fd *fd, int unlink )
         return;
     }
 
-    fd->closed->unlink = unlink || (fd->options & FILE_DELETE_ON_CLOSE);
+    fd->closed->unlink = unlink ? 1 : 0;
+    if (fd->options & FILE_DELETE_ON_CLOSE)
+        fd->closed->unlink = -1;
 }
 
 /* set new name for the fd */




More information about the wine-cvs mailing list