Skip to content
Snippets Groups Projects
Commit 2576a07e authored by Philip Withnall's avatar Philip Withnall
Browse files

glnx-local-alloc: Make check for invalid FDs more general


In general, all FDs < 0 are invalid (and should not have close() called
on them), so check that. This could have caused problems if a function
returned an error value < -1.

Signed-off-by: default avatarPhilip Withnall <withnall@endlessm.com>
parent 4040f55a
No related branches found
No related tags found
No related merge requests found
...@@ -199,9 +199,9 @@ glnx_cleanup_close_fdp (int *fdp) ...@@ -199,9 +199,9 @@ glnx_cleanup_close_fdp (int *fdp)
int fd, errsv; int fd, errsv;
g_assert (fdp); g_assert (fdp);
fd = *fdp; fd = *fdp;
if (fd != -1) if (fd >= 0)
{ {
errsv = errno; errsv = errno;
(void) close (fd); (void) close (fd);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment