sqc 0.4.13

Software Code Quality - CERT C compliance checker
/*
 * Rule: FIO42-C
 * Source: wiki
 * Status: PASS - Should NOT trigger FIO42-C violation
 */

#include <Windows.h>
 
int func(LPCTSTR filename) {
  HANDLE hFile = CreateFile(filename, GENERIC_READ, 0, NULL,
                            OPEN_EXISTING,
                            FILE_ATTRIBUTE_NORMAL, NULL);
  if (INVALID_HANDLE_VALUE == hFile) {
    return -1;
  } 
  /* ... */ 
  if (!CloseHandle(hFile)) {
    return -1;
  }
 
  return 0;
}