blob: ed73032c730ae658b35e54dcc63ede9b5d8edc64 [file] [log] [blame] [raw]
/*
* close.c: close implementation for Windows.
*
* This file has no copyright assigned and is placed in the Public Domain.
* This file is a part of the mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within the package.
*
* Written by Pedro Alves <pedro_alves@portugalmail.pt> Feb 2007
*
*/
#include <unistd.h>
#include <windows.h>
#if _WCE >= 2
#include <stdio.h>
#endif
int close(int fd) {
#if _WCE >= 2
if(fd == 0 || fd == 1 || fd == 2) fd = fileno(_getstdfilex(fd));
#endif
return CloseHandle((void *)fd) ? 0 : -1;
}