/* Test of perror() function.
- Copyright (C) 2011 Free Software Foundation, Inc.
+ Copyright (C) 2011-2013 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
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
int
main (void)
{
- FILE *fp;
-
/* We change fd 2 later, so save it in fd 10. */
if (dup2 (STDERR_FILENO, BACKUP_STDERR_FILENO) != BACKUP_STDERR_FILENO
|| (myerr = fdopen (BACKUP_STDERR_FILENO, "w")) == NULL)
ASSERT (msg2 == msg4 || STREQ (msg2, str2));
ASSERT (msg3 == msg4 || STREQ (msg3, str3));
ASSERT (STREQ (msg4, str4));
+
+ free (str1);
+ free (str2);
+ free (str3);
+ free (str4);
}
/* Test that perror uses the same message as strerror. */
/* Test that perror reports write failure. */
{
ASSERT (freopen (BASE ".tmp", "r", stderr) == stderr);
- ASSERT (setvbuf (stderr, NULL, _IOLBF, BUFSIZ) == 0);
+ ASSERT (setvbuf (stderr, NULL, _IONBF, BUFSIZ) == 0);
errno = -1;
ASSERT (!ferror (stderr));
perror (NULL);
- ASSERT (errno > 0);
#if 0
+ /* Commented out until cygwin behaves:
+ http://sourceware.org/ml/newlib/2011/msg00228.html */
+ ASSERT (errno > 0);
/* Commented out until glibc behaves:
http://sourceware.org/bugzilla/show_bug.cgi?id=12792 */
ASSERT (ferror (stderr));