Improve logger behavior when out of disk space
I actually tried it, and found a few places that didn't fully work.
Might still be more, but it's definitely closer now.
It'd be nice to test this stuff, but it's hard to set up a valid test.
Change-Id: If2ad1b9d91a116515215eaa49140b1aa0230fc93
diff --git a/aos/util/file.h b/aos/util/file.h
index 9ee2fb4..bf216bb 100644
--- a/aos/util/file.h
+++ b/aos/util/file.h
@@ -4,6 +4,8 @@
#include <string>
#include <string_view>
+#include "glog/logging.h"
+
namespace aos {
namespace util {
@@ -15,7 +17,12 @@
void WriteStringToFileOrDie(const std::string_view filename,
const std::string_view contents);
-void MkdirP(std::string_view path, mode_t mode);
+// Returns true if it succeeds or false if the filesystem is full.
+bool MkdirPIfSpace(std::string_view path, mode_t mode);
+
+inline void MkdirP(std::string_view path, mode_t mode) {
+ CHECK(MkdirPIfSpace(path, mode));
+}
bool PathExists(std::string_view path);