From b511268389f2a4c2e04c3eaadb58de909750e845 Mon Sep 17 00:00:00 2001 From: Ben Collins Date: Mon, 6 Jan 2025 15:35:17 +0000 Subject: [PATCH] jwt_encode_fp: Reduce code to avoid uncovered lines Signed-off-by: Ben Collins --- libjwt/jwt-encode.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/libjwt/jwt-encode.c b/libjwt/jwt-encode.c index 776f46ad..c416dd67 100644 --- a/libjwt/jwt-encode.c +++ b/libjwt/jwt-encode.c @@ -210,15 +210,12 @@ static int jwt_encode(jwt_t *jwt, char **out) int jwt_encode_fp(jwt_t *jwt, FILE *fp) { char_auto *str = NULL; - int ret; - - ret = jwt_encode(jwt, &str); - if (ret) - return ret; - fputs(str, fp); + errno = jwt_encode(jwt, &str); + if (!errno) + fputs(str, fp); - return 0; + return errno; } char *jwt_encode_str(jwt_t *jwt)