X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=tests%2Ftest-dup3.c;h=4392f9e3c260aa19938c74953c1563840214da45;hb=308c394b3c4ee0bc13826b381b9f0668481c4a0f;hp=9133b7bf4b330c8a2eb5fc16f18c1cf6febb66bf;hpb=89ae4589dd58d12e7cbcf0e92c1d828c1e430f97;p=gnulib.git diff --git a/tests/test-dup3.c b/tests/test-dup3.c index 9133b7bf4..4392f9e3c 100644 --- a/tests/test-dup3.c +++ b/tests/test-dup3.c @@ -1,5 +1,5 @@ /* Test duplicating file descriptors. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2012 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,35 +27,24 @@ SIGNATURE_CHECK (dup3, int, (int, int, int)); #include #include #include -#include -#include #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -/* Get declarations of the Win32 API functions. */ +/* Get declarations of the native Windows API functions. */ # define WIN32_LEAN_AND_MEAN # include +/* Get _get_osfhandle. */ +# include "msvc-nothrow.h" #endif #include "binary-io.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Return true if FD is open. */ static bool is_open (int fd) { #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - /* On Win32, the initial state of unassigned standard file + /* On native Windows, the initial state of unassigned standard file descriptors is that they are open but point to an INVALID_HANDLE_VALUE, and there is no fcntl. */ return (HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE; @@ -88,7 +77,7 @@ main () { int use_cloexec; -#if defined O_CLOEXEC +#if O_CLOEXEC for (use_cloexec = 0; use_cloexec <= 1; use_cloexec++) #else use_cloexec = 0; @@ -100,7 +89,7 @@ main () char buffer[1]; o_flags = 0; -#if defined O_CLOEXEC +#if O_CLOEXEC if (use_cloexec) o_flags |= O_CLOEXEC; #endif