-
-
Save sanmai/ae1f3c156c3dadd3b3ceec113a370a98 to your computer and use it in GitHub Desktop.
Dropbox ext4 hack
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
/* | |
* dropbox_ext4.c | |
* | |
* Compile like this: | |
* gcc -shared -fPIC -ldl -o libdropbox_ext4.so dropbox_ext4.c | |
* | |
* Run Dropbox like this: | |
* LD_PRELOAD=./libdropbox_ext4.so ~/.dropbox-dist/dropboxd | |
*/ | |
#define _GNU_SOURCE | |
#include <stdlib.h> | |
#include <sys/vfs.h> | |
#include <linux/magic.h> | |
#include <dlfcn.h> | |
int (*orig_statfs)(const char *path, struct statfs64 *buf) = NULL; | |
int statfs64(const char *path, struct statfs64 *buf) { | |
if (orig_statfs == NULL) { | |
orig_statfs = dlsym(RTLD_NEXT, "statfs64"); | |
} | |
int retval = orig_statfs(path, buf); | |
if (retval == 0) { | |
buf->f_type = EXT4_SUPER_MAGIC; | |
} | |
return retval; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment