Closed matteodelabre closed 3 years ago
looks reasonable, thanks for fixing this! just need to test (later today, probably) before merging (unless someone beats me to it)
tested that this works for client.so by invoking LD_PRELOAD=/home/root/rm2fb/librm2fb_client.so.1.0.0 fbink hello world
and seeing hello world appear in top left.
Running
LD_PRELOAD=/path/to/librm2fb_client.so.1.0.0 xochitl
currently results in a segfault becauseswtfb::locate_signature
is called with a relative binary path, and thereforefopen
fails inswtfb::read_file
.This patch replaces the use of
argv[0]
with reading/proc/self/exe
which always return an absolute path to the current executable.It also adds some error checking to
swtfb::read_file
so that we get a nicer error message instead of a segfault, should a similar bug happen again.