[Bug other/108276] libiberty unlink_if_ordinary does not handle Windows nul device correctly
himalr at proton dot me
gcc-bugzilla@gcc.gnu.org
Tue Jan 17 01:18:31 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108276
--- Comment #5 from Himal <himalr at proton dot me> ---
(In reply to niXman from comment #4)
> (In reply to niXman from comment #2)
>
> > I don't think the patch is correct because for WIN32 platform `unlink()`
> > will never be called even for non-"nul" files.
>
> moreover, according to the man:
> https://github.com/MicrosoftDocs/cpp-docs/blob/main/docs/c-runtime-library/
> reference/unlink-wunlink.md
>
> microsoft's `unlink()/_unlink()` works as just `remove()`.
Hi, Thanks for the feedback. I noticed this while looking for
[this](https://sourceware.org/bugzilla/show_bug.cgi?id=29947) bug.
In MSYS/MinGW, It calls the `unlink` function even for 'nul', but it wasn't
throwing any errors.
I decided to submit this patch because it already has some code checking for
special devices before calling `unlink`. If it's not required then I guess we
can close this.
Thanks.
More information about the Gcc-bugs
mailing list