diff options
Diffstat (limited to 'patches/ima-evm-utils-1.1/0004-evmctl-find-add-missing-error-handling-and-propagate.patch')
-rw-r--r-- | patches/ima-evm-utils-1.1/0004-evmctl-find-add-missing-error-handling-and-propagate.patch | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/patches/ima-evm-utils-1.1/0004-evmctl-find-add-missing-error-handling-and-propagate.patch b/patches/ima-evm-utils-1.1/0004-evmctl-find-add-missing-error-handling-and-propagate.patch new file mode 100644 index 000000000..68660d95e --- /dev/null +++ b/patches/ima-evm-utils-1.1/0004-evmctl-find-add-missing-error-handling-and-propagate.patch @@ -0,0 +1,56 @@ +From: Marc Kleine-Budde <mkl@pengutronix.de> +Date: Fri, 13 Nov 2015 14:04:37 +0100 +Subject: [PATCH] evmctl: find(): add missing error handling and propagate + error + +This patch adds the missing error handling to the while() loop in the find() +function, so that evmctl properly fails on errors. + +Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> +--- + src/evmctl.c | 20 ++++++++++++++++---- + 1 file changed, 16 insertions(+), 4 deletions(-) + +diff --git a/src/evmctl.c b/src/evmctl.c +index 20eccfa93b2b..55fc619f5990 100644 +--- a/src/evmctl.c ++++ b/src/evmctl.c +@@ -1234,13 +1234,20 @@ static int find(const char *path, int dts, find_cb_t func) + } + + while ((de = readdir(dir))) { ++ int err = 0; ++ + if (!strcmp(de->d_name, "..") || !strcmp(de->d_name, ".")) + continue; + log_debug("path: %s, type: %u\n", de->d_name, de->d_type); + if (de->d_type == DT_DIR) +- find(de->d_name, dts, func); ++ err = find(de->d_name, dts, func); + else if (dts & (1 << de->d_type)) +- func(de->d_name); ++ err = func(de->d_name); ++ ++ if (err) { ++ closedir(dir); ++ return -1; ++ } + } + + if (chdir("..")) { +@@ -1249,8 +1256,13 @@ static int find(const char *path, int dts, find_cb_t func) + return -1; + } + +- if (dts & DIR_MASK) +- func(path); ++ if (dts & DIR_MASK) { ++ int err; ++ ++ err = func(path); ++ if (err) ++ return -1; ++ } + + closedir(dir); + |