diff --git a/port_fwd.c b/port_fwd.c index fc4d5cb..eac8d2f 100644 --- a/port_fwd.c +++ b/port_fwd.c @@ -45,6 +45,9 @@ static void procfs_scan_listen(int fd, unsigned int lstate, unsigned int state; char *line; + if (fd < 0) + return; + if (lseek(fd, 0, SEEK_SET)) { warn("lseek() failed on /proc/net file: %s", strerror(errno)); return;