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.cc b/aos/util/file.cc
index 089efbc..afefa86 100644
--- a/aos/util/file.cc
+++ b/aos/util/file.cc
@@ -8,7 +8,6 @@
 #include <string_view>
 
 #include "aos/scoped/scoped_fd.h"
-#include "glog/logging.h"
 
 namespace aos {
 namespace util {
@@ -48,22 +47,30 @@
   }
 }
 
-void MkdirP(std::string_view path, mode_t mode) {
+bool MkdirPIfSpace(std::string_view path, mode_t mode) {
   auto last_slash_pos = path.find_last_of("/");
 
   std::string folder(last_slash_pos == std::string_view::npos
                          ? std::string_view("")
                          : path.substr(0, last_slash_pos));
-  if (folder.empty()) return;
-  MkdirP(folder, mode);
+  if (folder.empty()) {
+    return true;
+  }
+  if (!MkdirPIfSpace(folder, mode)) {
+    return false;
+  }
   const int result = mkdir(folder.c_str(), mode);
   if (result == -1 && errno == EEXIST) {
     VLOG(2) << folder << " already exists";
-    return;
+    return true;
+  } else if (result == -1 && errno == ENOSPC) {
+    VLOG(2) << "Out of space";
+    return false;
   } else {
     VLOG(1) << "Created " << folder;
   }
   PCHECK(result == 0) << ": Error creating " << folder;
+  return true;
 }
 
 bool PathExists(std::string_view path) {