Created
August 15, 2018 07:28
-
-
Save dimaryaz/275f2dacc7ac50cebd33fc0217b5c249 to your computer and use it in GitHub Desktop.
Dropbox ext4 hack
This file contains hidden or 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
@dimaryaz Have you figured out a way how to do that with newer clients?