X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-dup-safer.c;h=5cb45f5fd4fb70b3f8fac70fc93a092261741891;hb=eea38e67b2eb57529b01092d86178935d7ead222;hp=24cc9e5f377f46f97403b83236cef29dcb23b0dc;hpb=a1afba1b2122388e9a120b6a1f011367e6db1518;p=gnulib.git diff --git a/tests/test-dup-safer.c b/tests/test-dup-safer.c index 24cc9e5f3..5cb45f5fd 100644 --- a/tests/test-dup-safer.c +++ b/tests/test-dup-safer.c @@ -1,5 +1,5 @@ /* Test that dup_safer leaves standard fds alone. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2011 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 @@ -24,8 +24,6 @@ #include #include #include -#include -#include #include "binary-io.h" #include "cloexec.h" @@ -34,34 +32,24 @@ /* Get declarations of the Win32 API functions. */ # define WIN32_LEAN_AND_MEAN # include +/* Get _get_osfhandle. */ +# include "msvc-nothrow.h" #endif #if !O_BINARY # define setmode(f,m) zero () static int zero (void) { return 0; } #endif -#ifndef O_CLOEXEC -# define O_CLOEXEC 0 -#endif /* This test intentionally closes stderr. So, we arrange to have fd 10 (outside the range of interesting fd's during the test) set up to duplicate the original stderr. */ #define BACKUP_STDERR_FILENO 10 -static FILE *myerr; +#define ASSERT_STREAM myerr +#include "macros.h" -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (myerr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (myerr); \ - abort (); \ - } \ - } \ - while (0) +static FILE *myerr; /* Return true if FD is open. */ static bool