diff --git a/Utils.cpp b/Utils.cpp
index c0b7f01..3bbdf3a 100644
--- a/Utils.cpp
+++ b/Utils.cpp
@@ -297,29 +297,25 @@
                     security_context_t context) {
     auto argv = ConvertToArgv(args);
 
-    int fd[2];
-    if (pipe2(fd, O_CLOEXEC) != 0) {
-        PLOG(ERROR) << "pipe2 in ForkExecvp";
+    android::base::unique_fd pipe_read, pipe_write;
+    if (!android::base::Pipe(&pipe_read, &pipe_write)) {
+        PLOG(ERROR) << "Pipe in ForkExecvp";
         return -errno;
     }
-    android::base::unique_fd pipe_read(fd[0]);
-    android::base::unique_fd pipe_write(fd[1]);
 
     pid_t pid = fork();
     if (pid == 0) {
         if (context) {
             if (setexeccon(context)) {
-                LOG(ERROR) << "Failed to setexeccon";
+                LOG(ERROR) << "Failed to setexeccon in ForkExecvp";
                 abort();
             }
         }
         pipe_read.reset();
-        if (pipe_write.get() != STDOUT_FILENO) {
-            dup2(pipe_write.get(), STDOUT_FILENO);
-            pipe_write.reset();
-        }
+        dup2(pipe_write.get(), STDOUT_FILENO);
+        pipe_write.reset();
         execvp(argv[0], const_cast<char**>(argv.data()));
-        PLOG(ERROR) << "Failed to exec";
+        PLOG(ERROR) << "exec in ForkExecvp";
         _exit(EXIT_FAILURE);
     }
     if (pid == -1) {
@@ -755,29 +751,10 @@
 }
 
 status_t UnmountTree(const std::string& prefix) {
-    FILE* fp = setmntent("/proc/mounts", "re");
-    if (fp == NULL) {
-        PLOG(ERROR) << "Failed to open /proc/mounts";
+    if (umount2(prefix.c_str(), MNT_DETACH)) {
+        PLOG(ERROR) << "Failed to unmount " << prefix;
         return -errno;
     }
-
-    // Some volumes can be stacked on each other, so force unmount in
-    // reverse order to give us the best chance of success.
-    std::list<std::string> toUnmount;
-    mntent* mentry;
-    while ((mentry = getmntent(fp)) != NULL) {
-        auto test = std::string(mentry->mnt_dir) + "/";
-        if (android::base::StartsWith(test, prefix)) {
-            toUnmount.push_front(test);
-        }
-    }
-    endmntent(fp);
-
-    for (const auto& path : toUnmount) {
-        if (umount2(path.c_str(), MNT_DETACH)) {
-            PLOG(ERROR) << "Failed to unmount " << path;
-        }
-    }
     return OK;
 }
 
