mirror of
https://github.com/postgres/postgres.git
synced 2025-05-01 01:04:50 +03:00
Cleanup pgwin32_open() 'if' test, and avoid possible error.
This commit is contained in:
parent
0184c6835c
commit
e15ce612b5
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/port/open.c,v 1.15 2006/09/24 17:19:53 tgl Exp $
|
* $PostgreSQL: pgsql/src/port/open.c,v 1.16 2006/10/03 20:44:18 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -105,9 +105,15 @@ pgwin32_open(const char *fileName, int fileFlags,...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* _open_osfhandle will, on error, set errno accordingly */
|
/* _open_osfhandle will, on error, set errno accordingly */
|
||||||
if ((fd = _open_osfhandle((long) h, fileFlags & O_APPEND)) < 0 ||
|
if ((fd = _open_osfhandle((long) h, fileFlags & O_APPEND)) < 0)
|
||||||
(fileFlags & (O_TEXT | O_BINARY) && (_setmode(fd, fileFlags & (O_TEXT | O_BINARY)) < 0)))
|
|
||||||
CloseHandle(h); /* will not affect errno */
|
CloseHandle(h); /* will not affect errno */
|
||||||
|
else if (fileFlags & (O_TEXT | O_BINARY) &&
|
||||||
|
_setmode(fd, fileFlags & (O_TEXT | O_BINARY)) < 0)
|
||||||
|
{
|
||||||
|
_close(fd);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user