Skip to content

Commit

Permalink
winpr/thread: don't close invalid file descriptors
Browse files Browse the repository at this point in the history
In case the file descriptor is -1 don't call close.
  • Loading branch information
bmiklautz committed Jul 24, 2015
1 parent 4250f3f commit c3ea07f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions winpr/libwinpr/thread/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,10 +504,10 @@ void cleanup_handle(void *obj)
WLog_ERR(TAG, "failed to destroy mutex [%d] %s (%d)",
rc, strerror(errno), errno);

if (thread->pipe_fd[0])
if (thread->pipe_fd[0] >= 0)
close(thread->pipe_fd[0]);

if (thread->pipe_fd[1])
if (thread->pipe_fd[1] >= 0)
close(thread->pipe_fd[1]);

if (thread_list && ListDictionary_Contains(thread_list, &thread->thread))
Expand Down

0 comments on commit c3ea07f

Please sign in to comment.