summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2020-10-16 03:24:17 +0100
committerDaniel Golle <daniel@makrotopia.org>2020-12-12 23:02:56 +0000
commit48625308a375a3d3e08446661491a8dd1fbf172d (patch)
tree24f7dbbf8f3d61a95e892927803bcc8c176c7889
parent0c6fb90e8c6e255e2b5da2c840fe534c7bc8cd7a (diff)
downloadfstools-48625308a375a3d3e08446661491a8dd1fbf172d.tar.gz
mount: restorecon: guard against execl() errors
In the current implementation, in case of execl("/sbin/restorecon") failing, the child process will also return and that will lead to even more disasterous effects. Though it seems unlikely that execl() would fail given that the file exists, simply catch that case by exiting in case execl() returns. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
-rw-r--r--libfstools/mount.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libfstools/mount.c b/libfstools/mount.c
index b30e5a6..1691ce7 100644
--- a/libfstools/mount.c
+++ b/libfstools/mount.c
@@ -99,7 +99,7 @@ selinux_restorecon(char *overlaydir)
restorecon_pid = fork();
if (!restorecon_pid)
- execl("/sbin/restorecon", "restorecon", overlaydir, (char *) NULL);
+ exit(execl("/sbin/restorecon", "restorecon", overlaydir, (char *) NULL));
else if (restorecon_pid > 0)
waitpid(restorecon_pid, &status, 0);
}