aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/hook_lib/file_hook.c5
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: