| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| /* A lib to fix the GAWK missing files problem */ /* Usage: export LD_PRELOAD=/path/to/this/lib */ #define _GNU_SOURCE #include <dlfcn.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <time.h> int open64(const char *path, int flags, ...) { static int (*real_open64) (const char *,int); static char *warn; int ret; if (!real_open64) { real_open64 = (int (*)(const char *,int)) dlsym(RTLD_NEXT,"open64"); if ((warn = getenv("OPENFIX_WARN"))) { long t = time(0); fprintf(stderr,"openfix: Initializing at: %s",ctime(&t)); } } if ((ret = real_open64(path,flags)) != -1) return ret; if (warn) fprintf(stderr,"openfix: open failed for '%s' (flags = %d)\n",path,flags); return real_open64("/dev/null",flags); } |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.