From 7414df4ef8d64b35b258fee28f683c1467338c66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Fu=C3=9F?= Date: Wed, 8 Feb 2017 17:45:38 +0100 Subject: [PATCH] Fix lsb_release/sw_vers errors on NetBSD fixes #4779 --- AUTHORS | 1 + lib/base/utility.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/AUTHORS b/AUTHORS index 6f025f2bf..3876ed731 100644 --- a/AUTHORS +++ b/AUTHORS @@ -34,6 +34,7 @@ David Beck Dinesh Majrekar Dirk Goetz Dolf Schimmel +Edgar Fuß Eduard Güldner Edvin Seferovic Eric Lippmann diff --git a/lib/base/utility.cpp b/lib/base/utility.cpp index ae375a917..c29284019 100644 --- a/lib/base/utility.cpp +++ b/lib/base/utility.cpp @@ -1556,7 +1556,7 @@ static bool ReleaseHelper(String *platformName, String *platformVersion) } /* You are using a distribution which supports LSB. */ - FILE *fp = popen("lsb_release -s -i 2>&1", "r"); + FILE *fp = popen("type lsb_release >/dev/null 2>&1 && lsb_release -s -i 2>&1", "r"); if (fp != NULL) { std::ostringstream msgbuf; @@ -1570,7 +1570,7 @@ static bool ReleaseHelper(String *platformName, String *platformVersion) } } - fp = popen("lsb_release -s -r 2>&1", "r"); + fp = popen("type lsb_release >/dev/null 2>&1 && lsb_release -s -r 2>&1", "r"); if (fp != NULL) { std::ostringstream msgbuf; @@ -1585,7 +1585,7 @@ static bool ReleaseHelper(String *platformName, String *platformVersion) } /* OS X */ - fp = popen("sw_vers -productName 2>&1", "r"); + fp = popen("type sw_vers >/dev/null 2>&1 && sw_vers -productName 2>&1", "r"); if (fp != NULL) { std::ostringstream msgbuf; @@ -1602,7 +1602,7 @@ static bool ReleaseHelper(String *platformName, String *platformVersion) } } - fp = popen("sw_vers -productVersion 2>&1", "r"); + fp = popen("type sw_vers >/dev/null 2>&1 && sw_vers -productVersion 2>&1", "r"); if (fp != NULL) { std::ostringstream msgbuf;