Redirecting Filesystem Paths via LD_PRELOAD

view story

http://stackoverflow.com – I am trying to set up a working Linux ecosystem inside an Android terminal emulator, but without actually having root access. This means that I need to adjust every reference to e.g. /bin/sh in the source code of every program I'm trying to compile and use. Setting LD_PRELOAD before starting an application allows me to modify the behaviour of libc fuctions, just like fakeroot does; so I might just write a library which redirects all syscalls with absolute path names (except /dev, /sys, and /proc for example) to the folder I have write access to. This library would have to: Rewrite all path (HowTos)