View Single Post
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#153
Originally Posted by allnameswereout View Post
Will this work? Can anyone compile this?

Code:
/*
 *
 * $ gcc -fpic -shared -o libwlancal.so libwlancal.c -ldl
 *
 */

#define _GNU_SOURCE
#include <stdio.h>
#include <dlfcn.h>

FILE* fopen(const char* path, const char* mode) {
	if (path == "/sys/devices/platform/wlan-omap/cal_mac_address") {
		printf("Opening %s\n", path);
		FILE* (*real_fopen)(const char*, const char*) =
			dlsym(RTLD_NEXT, "fopen");
		return real_fopen("/home/user/.oksikokos", mode);
	}
}
Compiled and stripped:
http://qwerty12.maemobox.org/libwlancal.so

(Haven't tested)