[PATCH 18/20] fsverity_cmd_sign() don't exit on error without closing file descriptor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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,
-				       &params, &digest))
-		goto out_err;
-
+	ret = libfsverity_compute_digest(&file, file_size, read_callback,
+					 &params, &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




[Index of Archives]     [linux Cryptography]     [Asterisk App Development]     [PJ SIP]     [Gnu Gatekeeper]     [IETF Sipping]     [Info Cyrus]     [ALSA User]     [Fedora Linux Users]     [Linux SCTP]     [DCCP]     [Gimp]     [Yosemite News]     [Deep Creek Hot Springs]     [Yosemite Campsites]     [ISDN Cause Codes]

  Powered by Linux