fix: close the file descriptor in get_win_title() (#245)

this would eventually end up opening too many fds and erroring out with
"too many open files".
This commit is contained in:
N-R-K 2022-03-17 19:18:22 +00:00 committed by GitHub
parent 7f71ddf4fc
commit 1ef0c1f152
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

1
main.c
View File

@ -260,6 +260,7 @@ size_t get_win_title(unsigned char *buf, int len, bool init)
if (pfd.readfd >= 0) { if (pfd.readfd >= 0) {
if ((n = read(pfd.readfd, buf, len-1)) > 0) if ((n = read(pfd.readfd, buf, len-1)) > 0)
buf[n] = '\0'; buf[n] = '\0';
close(pfd.readfd);
} }
} }