From eb376b5d196358dafe454a4778746e46bad48ee7 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Sun, 16 Jun 2024 08:07:46 +0100 Subject: [PATCH] win32: don't set error mode Commit a8c63f25b3 (win32: improve filesystem detection and display) added a call to SetErrorMode(SEM_FAILCRITICALERRORS). This was on the strength of the documentation for GetVolumeInformation() which suggests that otherwise a message box will appear to prompt the user to put media in an empty floppy or CD drive. This would disrupt the expected behaviour of applets like 'df'. In practice it seems the call to SetErrorMode() is unnecessary. It also results in other errors going unreported. Remove the call to SetErrorMode(). Saves 8-20 bytes. (GitHub issue #423) --- libbb/appletlib.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libbb/appletlib.c b/libbb/appletlib.c index 1f9968f106..51824f1b39 100644 --- a/libbb/appletlib.c +++ b/libbb/appletlib.c @@ -1349,10 +1349,6 @@ int main(int argc UNUSED_PARAM, char **argv) break; } } - - /* Ignore critical errors, such as calling GetVolumeInformation() on - * a floppy or CDROM drive with no media. */ - SetErrorMode(SEM_FAILCRITICALERRORS); #endif #if defined(__MINGW64_VERSION_MAJOR)