The lazy unmount flag isn't documented anywhere, so its
probably better to hide the nastiness behind a function
return dir_fd;
}
- if (umount2 (directory, PLY_SUPER_SECRET_LAZY_UNMOUNT_FLAG) < 0)
+ if (!ply_unmount_filesystem (directory))
{
ply_save_errno ();
umount (directory);
ply_restore_errno ();
return false;
}
-
rmdir (directory);
/* return a file descriptor to the directory because it's now been
return true;
}
+bool
+ply_unmount_filesystem (const char *directory)
+{
+ if (umount2 (directory, PLY_SUPER_SECRET_LAZY_UNMOUNT_FLAG) < 0)
+ return false;
+
+ return true;
+}
+
/* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */
int ply_detach_directory (const char *directory);
bool ply_copy_file (const char *source, const char *destination);
bool ply_copy_directory (const char *source, const char *destination);
+bool ply_unmount_filesystem (const char *directory);
#endif
#endif /* PLY_UTILS_H */