Skip to content

Instantly share code, notes, and snippets.

@seeruk
Forked from stbuehler/fix_umask.c
Created May 6, 2014 03:52
Show Gist options
  • Save seeruk/7ccc11ececbf2033f30c to your computer and use it in GitHub Desktop.
Save seeruk/7ccc11ececbf2033f30c to your computer and use it in GitHub Desktop.
/*
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