https://bugs.winehq.org/show_bug.cgi?id=43902
Bug ID: 43902 Summary: close() on a closed fd should set errno to EBADF Product: Wine Version: 2.0.2 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: msvcrt Assignee: wine-bugs@winehq.org Reporter: olly@survex.com Distribution: ---
Created attachment 59529 --> https://bugs.winehq.org/attachment.cgi?id=59529 Fix and regression test
Calling close() on an already closed fd should set errno to EBADF - currently it doesn't set errno at all, which I discovered because it causes Xapian's test suite to fail when run under wine (one testcase calls close(fd) and checks for EBADF as a way to confirm that fd has indeed already been closed).
I've attached a patch with a fix and a regression testcase. It's against 2.0.2, but inspecting the latest code shows the bug to still be present.