Commit 4781a41b authored by Julius Plenz's avatar Julius Plenz

Space change

parent 2acc4993
...@@ -72,14 +72,14 @@ static void init(void) ...@@ -72,14 +72,14 @@ static void init(void)
char *s; char *s;
char *error; char *error;
struct rlimit rlim; struct rlimit rlim;
getrlimit(RLIMIT_NOFILE, &rlim); getrlimit(RLIMIT_NOFILE, &rlim);
max_fds=(int) rlim.rlim_max; max_fds=(int) rlim.rlim_max;
fds=(struct fadv_info *) malloc(max_fds * sizeof(struct fadv_info)); fds=(struct fadv_info *) malloc(max_fds * sizeof(struct fadv_info));
assert(fds != NULL); assert(fds != NULL);
_original_open = (int (*)(const char *, int, mode_t)) _original_open = (int (*)(const char *, int, mode_t))
dlsym(RTLD_NEXT, "open"); dlsym(RTLD_NEXT, "open");
_original_open64 = (int (*)(const char *, int, mode_t)) _original_open64 = (int (*)(const char *, int, mode_t))
...@@ -256,13 +256,16 @@ FILE *fopen64(const char *path, const char *mode) ...@@ -256,13 +256,16 @@ FILE *fopen64(const char *path, const char *mode)
int fd; int fd;
FILE *fp; FILE *fp;
fp = NULL; fp = NULL;
if(!_original_fopen64) if(!_original_fopen64)
_original_fopen64 = (FILE *(*)(const char *, const char *)) dlsym(RTLD_NEXT, "fopen64"); _original_fopen64 = (FILE *(*)(const char *, const char *)) dlsym(RTLD_NEXT, "fopen64");
if(_original_fopen64) { if(_original_fopen64) {
if((fp = _original_fopen64(path, mode)) != NULL) if((fp = _original_fopen64(path, mode)) != NULL)
if((fd = fileno(fp)) != -1) if((fd = fileno(fp)) != -1)
store_pageinfo(fd); store_pageinfo(fd);
} }
return fp; return fp;
} }
...@@ -272,8 +275,8 @@ int fclose(FILE *fp) ...@@ -272,8 +275,8 @@ int fclose(FILE *fp)
_original_fclose = (int (*)(FILE *)) dlsym(RTLD_NEXT, "fclose"); _original_fclose = (int (*)(FILE *)) dlsym(RTLD_NEXT, "fclose");
if(_original_fclose) { if(_original_fclose) {
free_unclaimed_pages(fileno(fp)); free_unclaimed_pages(fileno(fp));
return _original_fclose(fp); return _original_fclose(fp);
} }
errno = EFAULT; errno = EFAULT;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment