summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Farrugia <mark.farrugia@fiberdyne.com.au>2018-10-29 15:48:52 +1100
committerMark Farrugia <mark.farrugia@fiberdyne.com.au>2018-10-30 13:43:43 +1100
commite33eaca8a79ca7ac54f93ef7c57690c00274c54b (patch)
tree913ae2ec4669f65a49a5eecded0fcc869bd88de4
parentd5fe8bfe926f643e32d2bc0097dbee45f8410e28 (diff)
Add check for existing /config directory
Before mkdir'ing /config, check whether it has been created already. Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
-rw-r--r--src/avirt-config.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/avirt-config.c b/src/avirt-config.c
index 5fb714f..db3965d 100644
--- a/src/avirt-config.c
+++ b/src/avirt-config.c
@@ -61,10 +61,16 @@ static bool card_sealed = false;
static int mount_configfs()
{
int err;
-
+ struct stat st = {0};
+ if (stat("/config", &st) == -1)
+ mkdir("/config", S_IRWXU | S_IRWXG | S_IRWXO);
+
err = mount("none", "/config", "configfs", 0, NULL);
if (!err)
+ {
+ AVIRT_DEBUG("Successfully mounted configfs");
configfs_mounted = true;
+ }
else
AVIRT_ERROR("Failed to mount configfs filesystem!");