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

This commit is contained in:
Paul Chitescu 2009-12-08 14:10:01 +02:00 committed by Alexandre Julliard
parent d1e592ad20
commit 923524951a
2 changed files with 2 additions and 2 deletions

View File

@ -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;

View File

@ -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;