summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Farrugia <mark.farrugia@fiberdyne.com.au>2018-10-01 17:13:28 +1000
committerMark Farrugia <mark.farrugia@fiberdyne.com.au>2018-10-30 13:43:40 +1100
commit11befb8989854bf8cb03df8df1c872b66e4b39f6 (patch)
treec793709f396969fcd14ec319865f6d226b30a583
parentc9c96726dc37dd8ef1815974a60b29fe12b65d60 (diff)
Added card_sealed bool
We don't want to allow AVIRT_SealCard to be called more than once. Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
-rw-r--r--src/avirt-config.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/avirt-config.c b/src/avirt-config.c
index d2b1d5e..53af9db 100644
--- a/src/avirt-config.c
+++ b/src/avirt-config.c
@@ -58,6 +58,7 @@
#endif
static bool configfs_mounted = false;
+static bool card_sealed = false;
static int mount_configfs()
{
@@ -132,6 +133,12 @@ int AVIRT_SealCard()
char path_sealed[AVIRT_CONFIGFS_PATH_MAXLEN];
FILE *fd;
+ if (card_sealed)
+ {
+ AVIRT_ERROR("Card is already sealed!");
+ return -1;
+ }
+
if (!configfs_mounted) {
err = mount_configfs();
if (err < 0)
@@ -149,4 +156,6 @@ int AVIRT_SealCard()
fprintf(fd, "%d", 1);
fclose(fd);
+
+ card_sealed = true;
}