octave-maintainers
[Top][All Lists]
Advanced

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

Re: Poor Win32 C runtime implementation


From: Michael Goffioul
Subject: Re: Poor Win32 C runtime implementation
Date: Tue, 16 Feb 2010 11:23:02 +0000

On Tue, Feb 16, 2010 at 9:41 AM, Benjamin Lindner <address@hidden> wrote:
>> triggered by some gnulib replacement functions. This affects the VC2008
>> runtime DLL, I didn't test if this also affect the runtime DLL used by
>> MinGW.
>
> Oi, I need to check this.

hopefully, MSVCRT.DLL won't be affected, but I didn't check.

>> 2) "fclose" with an invalid file descriptor
>>
>> #include <stdio.h>
>> #include <io.h>
>> int main()
>> {
>>  FILE *fp = fopen("configure", "r");
>>  close(fileno(fp));
>>  fclose(fp);
>>  return 0;
>> }
>>
>
> I don't understand what gnulib does here. If I use gnulib, are the
> fopen/fclose functions from the CRT in this example replaced by gnulib
> implementations?
> Is this really a good idea to do?

There's a quite complex logic in the m4 code that leads up to decide that
it needs to replace fclose by its own version (which eventually calls the
CRT fclose, but with an invalid underlying file descriptor, leading to crash).
To be honest, I didn't try to understand *why* it decides to replace fclose,
as I said, the logic is quite complex. But I think this is a side-effect of
another check: "close" needs to be replaced, because it does not support
trailing slashes, which forces fclose to be replaced (or something similar).

Michael.



reply via email to

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