commit 3ff4cd3cb7275ff6501f11112459f19981554d1e from: Stefan Sperling via: Thomas Adam date: Mon Jun 13 17:55:22 2022 UTC fix error case handling in print_commit_oneline(); pointed out by op@ commit - aba5482ebaaee13ae12a318b6be73e480fc5d557 commit + 3ff4cd3cb7275ff6501f11112459f19981554d1e blob - 7982433cd29d0e8bc48869bb1bb8dfcf5ae59819 blob + 37e87e60ed84e21e9d89ec1ffcd25be3693afafd --- got/got.c +++ got/got.c @@ -3902,7 +3902,7 @@ print_commit_oneline(struct got_commit_object *commit, if (refs) { err = build_refs_str(&ref_str, refs, id, repo, 1); if (err) - goto done; + return err; /* Display the first matching ref only. */ if (ref_str && (comma = strchr(ref_str, ',')) != NULL) @@ -3916,10 +3916,14 @@ print_commit_oneline(struct got_commit_object *commit, } committer_time = got_object_commit_get_committer_time(commit); - if (gmtime_r(&committer_time, &tm) == NULL) - return got_error_from_errno("gmtime_r"); - if (strftime(datebuf, sizeof(datebuf), "%G-%m-%d ", &tm) == 0) - return got_error(GOT_ERR_NO_SPACE); + if (gmtime_r(&committer_time, &tm) == NULL) { + err = got_error_from_errno("gmtime_r"); + goto done; + } + if (strftime(datebuf, sizeof(datebuf), "%G-%m-%d ", &tm) == 0) { + err = got_error(GOT_ERR_NO_SPACE); + goto done; + } err = got_object_commit_get_logmsg(&logmsg0, commit); if (err)