X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-perror2.c;h=197870d4aa07699da12df514681f6a325ff73acb;hb=dbf55f6694dbf710b44e3ae76a46fd8b8f993f7c;hp=fe5e33eba0a0065f19601c68dd29f81d32f7ff71;hpb=88dabde472b81a034a72484a32ef51d0fd549db8;p=gnulib.git diff --git a/tests/test-perror2.c b/tests/test-perror2.c index fe5e33eba..197870d4a 100644 --- a/tests/test-perror2.c +++ b/tests/test-perror2.c @@ -1,5 +1,5 @@ /* 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 @@ -12,8 +12,7 @@ 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 . */ #include @@ -37,8 +36,6 @@ static FILE *myerr; 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) @@ -86,6 +83,11 @@ main (void) 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. */ @@ -113,12 +115,14 @@ main (void) /* 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));