got rid of all uses of strerror
This required some minor refactoring of other things and there were some
other small cleanups I noticed along the way.
diff --git a/bbb_cape/src/flasher/stm32_flasher.cc b/bbb_cape/src/flasher/stm32_flasher.cc
index a48abc4..d9d87fe 100644
--- a/bbb_cape/src/flasher/stm32_flasher.cc
+++ b/bbb_cape/src/flasher/stm32_flasher.cc
@@ -60,8 +60,7 @@
filename = target;
file = open(filename.c_str(), O_RDONLY);
if (file == -1) {
- LOG(FATAL, "open(%s, O_RDONLY) failed with %d: %s\n",
- filename.c_str(), errno, strerror(errno));
+ PLOG(FATAL, "open(%s, O_RDONLY) failed", filename.c_str());
} else {
LOG(INFO, "using filename %s from the command line\n", filename.c_str());
}
@@ -73,8 +72,7 @@
2 /* record type */];
ssize_t bytes = read(file, buffer, sizeof(buffer));
if (close(file) == -1) {
- LOG(FATAL, "close(%d) failed with %d: %s\n",
- file, errno, strerror(errno));
+ PLOG(FATAL, "close(%d) failed", file);
}
if (bytes != sizeof(buffer)) {
LOG(FATAL, "read %zd bytes from %s instead of %zu\n",
@@ -107,7 +105,7 @@
LOG(FATAL, "%s parser failed to initialize.\n", parser->name);
}
if (parser->open(p_st, filename.c_str(), 0) != PARSER_ERR_OK) {
- LOG(FATAL, "opening file %s failed\n", filename.c_str());
+ PLOG(FATAL, "opening file %s failed\n", filename.c_str());
}
::bbb::ExportUart();
@@ -116,15 +114,13 @@
serial_t *serial = serial_open(device);
if (serial == NULL) {
- LOG(FATAL, "failed to open serial port %s because of %d: %s\n",
- device, errno, strerror(errno));
+ PLOG(FATAL, "failed to open serial port %s", device);
}
if (serial_setup(serial, baud_rate,
SERIAL_BITS_8,
SERIAL_PARITY_EVEN,
SERIAL_STOPBIT_1) != SERIAL_ERR_OK) {
- LOG(FATAL, "setting up serial port %s failed because of %d: %s\n",
- device, errno, strerror(errno));
+ PLOG(FATAL, "setting up serial port %s failed", device);
}
LOG(INFO, "serial configuration: %s\n", serial_get_setup_str(serial));