Use ErrnoNumberAsString from libbase
Calling strerror_r is tricky, as glibc provides the GNU version
if _GNU_SOURCE is set, and musl libc only provides the posix version.
Handle the complexity once in libbase and reuse it here.
Bug: 190084016
Test: m USE_HOST_MUSL=true host-native
Change-Id: Id7b600d0cdd5804c75612c4d253637a281d3f0ff
diff --git a/payload_consumer/file_writer.h b/payload_consumer/file_writer.h
index cdc9fa0..ec391a3 100644
--- a/payload_consumer/file_writer.h
+++ b/payload_consumer/file_writer.h
@@ -22,6 +22,7 @@
#include <sys/types.h>
#include <unistd.h>
+#include <android-base/strings.h>
#include <base/logging.h>
#include "update_engine/common/error_code.h"
@@ -88,7 +89,7 @@
int err = writer_->Close();
if (err)
LOG(ERROR) << "FileWriter::Close failed: "
- << utils::ErrnoNumberAsString(-err);
+ << android::base::ErrnoNumberAsString(-err);
}
private: