-
-
Save seeruk/7ccc11ececbf2033f30c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
compile with: | |
gcc -shared -fPIC fix_umask.c -o fix_umask.so | |
edit /usr/bin/subl to include (fix the path to fix_umask.so if necessary): | |
#!/bin/sh | |
export LD_PRELOAD=/opt/sublime_text/fix_umask.so | |
exec /opt/sublime_text/sublime_text "$@" | |
*/ | |
#include <sys/types.h> | |
#include <sys/stat.h> | |
#define _GNU_SOURCE /* See feature_test_macros(7) */ | |
#include <unistd.h> | |
#include <sys/syscall.h> /* For SYS_xxx definitions */ | |
mode_t umask(mode_t mask) { | |
mask |= 0022; | |
return syscall(SYS_umask, mask); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment