It is practically impossible for `/proc/self/fd/%d` to result in a
string of PATH_MAX size. Remove the unreachable error handling.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/345
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
char fd_path[PATH_MAX];
ssize_t len;
- len = snprintf(proc_path, sizeof(proc_path), "/proc/self/fd/%d", fd);
- if (len < 0 || len >= (ssize_t)sizeof(proc_path))
- return NULL;
+ snprintf(proc_path, sizeof(proc_path), "/proc/self/fd/%d", fd);
/*
* We are using mkstemp to create a temporary file. We need to read the link since