Paul Chitescu : server: Only check if permission bits changed before calling fchmod().

Alexandre Julliard julliard at winehq.org
Tue Dec 8 11:10:38 CST 2009


Module: wine
Branch: master
Commit: 923524951aa3c138d67f7a848baeef3bcc1bae34
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=923524951aa3c138d67f7a848baeef3bcc1bae34

Author: Paul Chitescu <paulc at voip.null.ro>
Date:   Tue Dec  8 14:10:01 2009 +0200

server: Only check if permission bits changed before calling fchmod().

---

 server/change.c |    2 +-
 server/file.c   |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/server/change.c b/server/change.c
index 7ef456f..11b4729 100644
--- a/server/change.c
+++ b/server/change.c
@@ -376,7 +376,7 @@ static int dir_set_sd( struct object *obj, const struct security_descriptor *sd,
         mode = st.st_mode & (S_ISUID|S_ISGID|S_ISVTX|S_IRWXG);
         mode |= sd_to_mode( sd, owner );
 
-        if (st.st_mode != mode && fchmod( unix_fd, mode ) == -1)
+        if (((st.st_mode ^ mode) & (S_IRWXU|S_IRWXG|S_IRWXO)) && fchmod( unix_fd, mode ) == -1)
         {
             file_set_error();
             return 0;
diff --git a/server/file.c b/server/file.c
index 3e09ddd..5db64cd 100644
--- a/server/file.c
+++ b/server/file.c
@@ -560,7 +560,7 @@ static int file_set_sd( struct object *obj, const struct security_descriptor *sd
         mode = st.st_mode & (S_ISUID|S_ISGID|S_ISVTX|S_IRWXG);
         mode |= sd_to_mode( sd, owner );
 
-        if (st.st_mode != mode && fchmod( unix_fd, mode ) == -1)
+        if (((st.st_mode ^ mode) & (S_IRWXU|S_IRWXG|S_IRWXO)) && fchmod( unix_fd, mode ) == -1)
         {
             file_set_error();
             return 0;




More information about the wine-cvs mailing list