ext4_utils: fix build error without FILE_CONTEXTS
After commit 4df62f342dbbe2f5cca831ce789dc0426d32ec03,
occurs segmentation fault if mkuserimg.sh runs without FILE_CONTEXTS options.
It's due to strlen() for null value. To fix it, return 0 for null.
Change-Id: Icf99706e51b9053a24e23b9d081a258962877c30
diff --git a/ext4_utils/contents.c b/ext4_utils/contents.c
index 4899648..586e97e 100644
--- a/ext4_utils/contents.c
+++ b/ext4_utils/contents.c
@@ -467,6 +467,9 @@
int inode_set_selinux(u32 inode_num, const char *secon)
{
+ if (!secon)
+ return 0;
+
return xattr_add(inode_num, EXT4_XATTR_INDEX_SECURITY,
XATTR_SELINUX_SUFFIX, secon, strlen(secon) + 1);
}