diff options
author | Alexander Bersenev <bay@hackerdom.ru> | 2012-01-31 18:30:20 +0600 |
---|---|---|
committer | Alexander Bersenev <bay@hackerdom.ru> | 2012-01-31 18:30:20 +0600 |
commit | f02db3217ea416cabafe2d65e4d03ed372c3bf0c (patch) | |
tree | cf51fd54bbce8110b14b9e51d177eb6cb5ec508d | |
parent | add the kernel-cache option into fuse (diff) | |
download | autodep-f02db3217ea416cabafe2d65e4d03ed372c3bf0c.tar.gz autodep-f02db3217ea416cabafe2d65e4d03ed372c3bf0c.tar.bz2 autodep-f02db3217ea416cabafe2d65e4d03ed372c3bf0c.zip |
fixed crashes in ruby's rb_thread_blocking_region(). Shrink buffer for proc entrys
-rw-r--r-- | src/hook_lib/file_hook.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/hook_lib/file_hook.c b/src/hook_lib/file_hook.c index 728ab4e..cd3850a 100644 --- a/src/hook_lib/file_hook.c +++ b/src/hook_lib/file_hook.c @@ -22,6 +22,7 @@ #include <sys/un.h> #define MAXPATHLEN PATH_MAX +#define MAXPROCPATHLEN 512 #define MAXSOCKETPATHLEN 108 #define MAXFILEBUFFLEN 2048 @@ -292,9 +293,9 @@ static char * __get_stage(){ * Get full path by fd */ ssize_t __get_path_by_fd(int fd, char *output, int output_len) { - char path_to_fd_link[MAXPATHLEN]; + char path_to_fd_link[MAXPROCPATHLEN]; - snprintf(path_to_fd_link,MAXPATHLEN,"/proc/self/fd/%d",fd); + snprintf(path_to_fd_link,MAXPROCPATHLEN,"/proc/self/fd/%d",fd); ssize_t bytes_num=readlink(path_to_fd_link,output,output_len-1); output[bytes_num]=0; // because readlink don't do this if(output[0]!='/') return -1; // some odd string like pipe: |