Add timeout for fsck on untrusted media

Certain setups of cards can take a long time to fsck.
This adds a timeout to avoid angering the watchdog

Bug: 195615825
Test: Mount removable storage with ~30K folders,
      obeserve timeout in logs
Change-Id: I8b6e2658cf7024645f976599851bbee0557745ca
diff --git a/fs/Vfat.cpp b/fs/Vfat.cpp
index 4f1e982..f3f04d8 100644
--- a/fs/Vfat.cpp
+++ b/fs/Vfat.cpp
@@ -68,10 +68,9 @@
         cmd.push_back(source);
 
         // Fat devices are currently always untrusted
-        rc = ForkExecvp(cmd, nullptr, sFsckUntrustedContext);
-
+        rc = ForkExecvpTimeout(cmd, kUntrustedFsckSleepTime, sFsckUntrustedContext);
         if (rc < 0) {
-            LOG(ERROR) << "Filesystem check failed due to logwrap error";
+            LOG(ERROR) << "Filesystem check failed due to fork error";
             errno = EIO;
             return -1;
         }
@@ -81,6 +80,10 @@
                 LOG(INFO) << "Filesystem check completed OK";
                 return 0;
 
+            case 1:
+                LOG(INFO) << "Failed to check filesystem";
+                return -1;
+
             case 2:
                 LOG(ERROR) << "Filesystem check failed (not a FAT filesystem)";
                 errno = ENODATA;
@@ -100,6 +103,11 @@
                 errno = ENODATA;
                 return -1;
 
+            case ETIMEDOUT:
+                LOG(ERROR) << "Filesystem check timed out";
+                errno = ETIMEDOUT;
+                return -1;
+
             default:
                 LOG(ERROR) << "Filesystem check failed (unknown exit code " << rc << ")";
                 errno = EIO;