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)