Skip to content

Commit

Permalink
Fix checks for null HANDLE in Windows-only code
Browse files Browse the repository at this point in the history
clang-cl failed with "error: unordered comparison between pointer and zero
('HANDLE' (aka 'void *') and 'int')" in these two places introduced with
f219283 "Sub-task CORE-4463: Windows
implementation for CORE-4462 (Make it possible to restore compressed .nbk files
without explicitly decompressing them)" and
c2cfa78 "Prevent child process hung if it
writes too much data to the pipe and overflow the pipe buffer".
  • Loading branch information
stbergmann committed Dec 2, 2020
1 parent bf3dc9b commit a79117c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utilities/nbackup/nbackup.cpp
Expand Up @@ -385,7 +385,7 @@ FB_SIZE_T NBackup::read_file(FILE_HANDLE &file, void *buffer, FB_SIZE_T bufsize)
#ifdef WIN_NT
// Read child's stderr often to prevent child process hung if it writes
// too much data to the pipe and overflow the pipe buffer.
const bool checkChild = (childStdErr > 0 && file == backup);
const bool checkChild = (childStdErr != 0 && file == backup);
if (checkChild)
print_child_stderr();

Expand Down Expand Up @@ -790,7 +790,7 @@ void NBackup::close_backup()
return;
#ifdef WIN_NT
CloseHandle(backup);
if (childId > 0)
if (childId != 0)
{
const bool killed = (WaitForSingleObject(childId, 5000) != WAIT_OBJECT_0);
if (killed)
Expand Down

1 comment on commit a79117c

@aafemt
Copy link
Contributor

@aafemt aafemt commented on a79117c Dec 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comparison with INVALID_HANDLE_VALUE would be more correct for Windows code.

Please sign in to comment.