From: Jes Sorensen <jsorensen@xxxxxx> Signed-off-by: Jes Sorensen <jsorensen@xxxxxx> --- cmd_sign.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cmd_sign.c b/cmd_sign.c index d699d85..7d8ec58 100644 --- a/cmd_sign.c +++ b/cmd_sign.c @@ -73,7 +73,7 @@ int fsverity_cmd_sign(const struct fsverity_command *cmd, u16 alg_nr = 0; int digest_size; size_t sig_size; - int status; + int status, ret; int c; while ((c = getopt_long(argc, argv, "", longopts, NULL)) != -1) { @@ -154,12 +154,13 @@ int fsverity_cmd_sign(const struct fsverity_command *cmd, params.salt_size = salt_size; params.salt = salt; - if (libfsverity_compute_digest(&file, file_size, read_callback, - ¶ms, &digest)) - goto out_err; - + ret = libfsverity_compute_digest(&file, file_size, read_callback, + ¶ms, &digest); filedes_close(&file); + if (ret) + goto out_err; + digest_size = libfsverity_digest_size(alg_nr); memset(&sig_params, 0, sizeof(sig_params)); -- 2.25.3