ext4_utils: canonicalize slashes in paths
Simplify handling of slashes between directories in paths by
forcing them to have leading and trailing slashes as appropriate
when passed in to make_ext4fs, and then keeping all directory
paths with a trailing slash.
As a side effect, using "/" as the mountpoint is now supported.
Change-Id: I73fe709c26003a20b0bdf6504db16cc9e39edf9b
diff --git a/ext4_utils/make_ext4fs_main.c b/ext4_utils/make_ext4fs_main.c
index 000b857..8381f20 100644
--- a/ext4_utils/make_ext4fs_main.c
+++ b/ext4_utils/make_ext4fs_main.c
@@ -52,7 +52,7 @@
int opt;
const char *filename = NULL;
const char *directory = NULL;
- char *mountpoint = "";
+ char *mountpoint = NULL;
fs_config_func_t fs_config_func = NULL;
int gzip = 0;
int sparse = 0;
@@ -138,7 +138,7 @@
#if !defined(HOST)
// Use only if -S option not requested
- if (!sehnd && mountpoint[0] != '\0') {
+ if (!sehnd && mountpoint) {
sehnd = selinux_android_file_context_handle();
if (!sehnd) {