From: Vadim Zeitlin Date: Fri, 30 Mar 2007 13:22:18 +0000 (+0000) Subject: don't return junk from wxGetOsVersion() if we failed to execute 'uname -r' (thanks... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/e1379e29e21c7eabf6abf19a1f1f46163251b2a8 don't return junk from wxGetOsVersion() if we failed to execute 'uname -r' (thanks coverity) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45141 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/unix/utilsunx.cpp b/src/unix/utilsunx.cpp index 73148ac613..ff387a5124 100644 --- a/src/unix/utilsunx.cpp +++ b/src/unix/utilsunx.cpp @@ -915,9 +915,9 @@ wxOperatingSystemId wxGetOsVersion(int *verMaj, int *verMin) // get OS version int major, minor; wxString release = wxGetCommandOutput(wxT("uname -r")); - if ( !release.empty() && wxSscanf(release, wxT("%d.%d"), &major, &minor) != 2 ) + if ( release.empty() || wxSscanf(release, wxT("%d.%d"), &major, &minor) != 2 ) { - // unrecognized uname string format + // failed to get version string or unrecognized format major = minor = -1; }