@@ -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));