Skip to content

Commit

Permalink
fix compiler warning
Browse files Browse the repository at this point in the history
  • Loading branch information
RH-steve-grubb committed May 25, 2023
1 parent 957d272 commit 38b79bc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/library/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ char *get_file_from_fd(int fd, pid_t pid, size_t blen, char *buf)
char procfd_path[32];
ssize_t path_len;

if (blen == 0)
return NULL;

snprintf(procfd_path, sizeof(procfd_path)-1,
"/proc/self/fd/%d", fd);
path_len = readlink(procfd_path, buf, blen - 1);
Expand Down

0 comments on commit 38b79bc

Please sign in to comment.