Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
win tty: Use NULL consistently, don't mix with INVALID_HANDLE_VALUE
Browse files Browse the repository at this point in the history
  • Loading branch information
piscisaureus committed Sep 27, 2011
1 parent f5f005d commit 554cb78
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/win/tty.c
Expand Up @@ -325,8 +325,7 @@ static void uv_tty_queue_read_line(uv_loop_t* loop, uv_tty_t* handle) {

/* Duplicate the console handle, so if we want to cancel the read, we can */
/* just close this handle duplicate. */
if (handle->read_line_handle == NULL ||
handle->read_line_handle == INVALID_HANDLE_VALUE) {
if (handle->read_line_handle == NULL) {
HANDLE this_process = GetCurrentProcess();
r = DuplicateHandle(this_process,
handle->handle,
Expand All @@ -336,6 +335,7 @@ static void uv_tty_queue_read_line(uv_loop_t* loop, uv_tty_t* handle) {
0,
DUPLICATE_SAME_ACCESS);
if (!r) {
handle->read_line_handle = NULL;
SET_REQ_ERROR(req, GetLastError());
uv_insert_pending_req(loop, req);
goto out;
Expand Down Expand Up @@ -776,11 +776,10 @@ int uv_tty_read_stop(uv_tty_t* handle) {
}

/* Cancel line-buffered read */
if (handle->read_line_handle != NULL &&
handle->read_line_handle != INVALID_HANDLE_VALUE) {
if (handle->read_line_handle != NULL) {
/* Closing this handle will cancel the ReadConsole operation */
CloseHandle(handle->read_line_handle);
handle->read_line_handle = INVALID_HANDLE_VALUE;
handle->read_line_handle = NULL;
}


Expand Down

0 comments on commit 554cb78

Please sign in to comment.