From e1776acd193d36606bad4355711165aa572473fd Mon Sep 17 00:00:00 2001 From: vitaut Date: Sat, 14 Mar 2015 14:05:02 -0700 Subject: [PATCH] Handle the result of XSI-complint version of strerror_r correctly --- format.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/format.cc b/format.cc index 54455d83..da590548 100644 --- a/format.cc +++ b/format.cc @@ -160,7 +160,8 @@ int safe_strerror( // Handle the result of XSI-compliant version of strerror_r. int handle(int result) { - return result != 0 ? errno : result; + // glibc versions before 2.13 return result in errno. + return result == -1 ? errno : result; } // Handle the result of GNU-specific version of strerror_r.