6 ssize_t
write(int fd
, const void *buf
, size_t count
)
8 int (*real_write
)(int fd
, const void *buf
, size_t count
) = NULL
;
12 if (real_write
== NULL
) {
13 void *handle
= dlopen(/* "/lib/libc.so.6" */ "/lib/i386-linux-gnu/libc.so.6", RTLD_LAZY
);
15 fprintf(stderr
, "dlopen: %s\n", dlerror());
18 real_write
= dlsym(handle
, "write");
19 if (real_write
== NULL
) {
20 fprintf(stderr
, "dlsym: %s\n", dlerror());
26 real_write_return
= real_write(fd
, buf
, count
);
28 return real_write_return
;
31 // Fordítás: gcc -s -x c alarmwrite.c -fPIC -shared -o alarmwrite.so
32 // Futtatás: LD_PRELOAD=./alarmwrite.so x2vnc host:display