[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 15/21] freopen: workaround freopen() on OS/2 kLIBC
From: |
Bruno Haible |
Subject: |
Re: [PATCH 15/21] freopen: workaround freopen() on OS/2 kLIBC |
Date: |
Mon, 01 Dec 2014 01:01:24 +0100 |
User-agent: |
KMail/4.8.5 (Linux/3.2.0-64-generic; KDE/4.8.5; x86_64; ; ) |
> +#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;
1) In the comment you say 'if filename is NULL' but in the code you use
the (hacky) workaround code also if filename != NULL. Why?
2) When freopen returns NULL for success, does it set errno = 0, or does
it leave errno untouched? Can you find out, please, by using a test program
like
errno = 42;
FILE *result = freopen (NULL, mode, stream);
printf ("errno = %d\n", errno);
If it's the latter case (it leaves errno untouched), you need to add an
'errno = 0;' statement before the freopen call.
Bruno
- Re: [PATCH 14/21] getdtablesize: do not use getrlimit() on OS/2 kLIBC, (continued)
- [PATCH 13/21] w32spawn: clear SHELL_SPECIAL_CHARS and SHELL_SPACE_CHAR on OS/2 kLIBC, KO Myung-Hun, 2014/11/30
- [PATCH 16/21] wcwidth: fix 'conflicting types' error for `__wcwidth' on OS/2 kLIBC, KO Myung-Hun, 2014/11/30
- [PATCH 18/21] Workaround for dirfd() on OS/2 kLIBC, KO Myung-Hun, 2014/11/30
- [PATCH 15/21] freopen: workaround freopen() on OS/2 kLIBC, KO Myung-Hun, 2014/11/30
- [PATCH 17/21] Workaround for D_INO_IN_DIRENT on OS/2 kLIBC, KO Myung-Hun, 2014/11/30
- [PATCH 20/21] fdopendir: port to OS/2 kLIBC, KO Myung-Hun, 2014/11/30
- [PATCH 21/21] bootstrap: fix 'find: missing argument to `-exec'', KO Myung-Hun, 2014/11/30
- [PATCH 19/21] utimens: define HAVE_WORKING_UTIMES to 1 on OS/2 kLIBC, KO Myung-Hun, 2014/11/30