bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 15/21] freopen: workaround freopen() on OS/2 kLIBC


From: Paul Eggert
Subject: Re: [PATCH 15/21] freopen: workaround freopen() on OS/2 kLIBC
Date: Sun, 30 Nov 2014 11:39:33 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

I don't see why the workaround must be in freopen-safer.c. freopen-safer has freopen as a prerequisite, so it can assume that freopen doesn't have the bug in question.

+#ifdef __KLIBC__
+  FILE *result = freopen (filename, mode, stream);
+
+  /* On OS/2 kLIBC, freopen() returns NULL even if it is successful
+     if filename is NULL. */
+  if (!result && !errno)
+    result = stream;
+
+  return result;
+#else
   return freopen (filename, mode, stream);
+#endif

This should be refactored so that there's only one call to freopen, to avoid duplicating the code.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]