diff options
| -rw-r--r-- | common/os_calls.c | 19 | ||||
| -rw-r--r-- | common/os_calls.h | 2 | ||||
| -rw-r--r-- | sesman/sesman.c | 2 |
3 files changed, 19 insertions, 4 deletions
diff --git a/common/os_calls.c b/common/os_calls.c index 44a2e39f..2295745d 100644 --- a/common/os_calls.c +++ b/common/os_calls.c @@ -651,12 +651,27 @@ g_set_file_rights(char* filename, int read, int write) /*****************************************************************************/ /* returns error */ int -g_chmod(char* filename, int flags) +g_chmod_hex(char* filename, int flags) { #if defined(_WIN32) return 0; #else - return chmod(filename, flags); + int fl; + + fl = 0; + fl |= (flags & 0x4000) ? S_ISUID : 0; + fl |= (flags & 0x2000) ? S_ISGID : 0; + fl |= (flags & 0x1000) ? S_ISVTX : 0; + fl |= (flags & 0x0400) ? S_IRUSR : 0; + fl |= (flags & 0x0200) ? S_IWUSR : 0; + fl |= (flags & 0x0100) ? S_IXUSR : 0; + fl |= (flags & 0x0040) ? S_IRGRP : 0; + fl |= (flags & 0x0020) ? S_IWGRP : 0; + fl |= (flags & 0x0010) ? S_IXGRP : 0; + fl |= (flags & 0x0004) ? S_IROTH : 0; + fl |= (flags & 0x0002) ? S_IWOTH : 0; + fl |= (flags & 0x0001) ? S_IXOTH : 0; + return chmod(filename, fl); #endif } diff --git a/common/os_calls.h b/common/os_calls.h index ce015b8f..26c7cb09 100644 --- a/common/os_calls.h +++ b/common/os_calls.h @@ -100,7 +100,7 @@ g_file_lock(int fd, int start, int len); int g_set_file_rights(char* filename, int read, int write); int -g_chmod(char* filename, int flags); +g_chmod_hex(char* filename, int flags); int g_mkdir(char* dirname); char* diff --git a/sesman/sesman.c b/sesman/sesman.c index 9354e110..5c89f9db 100644 --- a/sesman/sesman.c +++ b/sesman/sesman.c @@ -267,7 +267,7 @@ main(int argc, char** argv) if (!g_directory_exist("/tmp/.X11-unix")) { g_create_dir("/tmp/.X11-unix"); - g_chmod("/tmp/.X11-unix", 0x1777); + g_chmod_hex("/tmp/.X11-unix", 0x1777); } sesman_main_loop(); |
