[PATCH] fixincludes: don't assume getcwd() can handle NULL argument

Bruce Korb bkorb@gnu.org
Thu Nov 11 00:51:53 GMT 2021


On 11/10/21 4:22 AM, Xi Ruoyao wrote:
>> Isn't this warning actually a glibc bug
>> <https://sourceware.org/bugzilla/show_bug.cgi?id=27476>?
> However we can't assume the libc we are using is Glibc.  Even if the
> libc supports getcwd() with NULL argument, we are still leaking memory.
You could also free the memory by calling exit(2). Something is pretty 
wrong if fixincludes cannot access a file it was told to process. So, 
technically, you're right. Practically, no difference. But it's fine by 
me to make the change. It does avoid a bug in a certain version of a 
certain library.


More information about the Gcc-patches mailing list