[PATCH v1] mkfs.ubifs: Fix mkfs.ubifs failure with option selinux
Zijun Hu
quic_zijuhu at quicinc.com
Fri May 26 01:47:33 PDT 2023
Below failure happens when mkfs.ubifs --selinux=FILE ...
"Error: bad file context FILE 1"
"No such file or directory (error 2)"
It is fixed by this change.
Signed-off-by: Zijun Hu <quic_zijuhu at quicinc.com>
---
ubifs-utils/mkfs.ubifs/mkfs.ubifs.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
index 8211ada..15e6bdc 100644
--- a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
+++ b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
@@ -733,6 +733,7 @@ static int get_options(int argc, char**argv)
if (!context)
return err_msg("xmalloc failed\n");
memcpy(context, optarg, context_len);
+ context[context_len] = '\0';
/* Make sure root directory exists */
if (stat(context, &context_st))
--
2.17.1
More information about the linux-mtd
mailing list