commit 85c34e74e98435d0ebb99360b18587411a652741 from: Stefan Sperling date: Mon Jun 13 09:37:38 2022 UTC fix error case handling in print_commit_oneline(); pointed out by op@ commit - 61dd0f65df684a93379cfa4c195ba43ee493bfc7 commit + 85c34e74e98435d0ebb99360b18587411a652741 blob - b5cc0d766589d88610458ba52595511cd0f39987 blob + 4820a2165e94f15daabdf5007b667947b46f6049 --- got/got.c +++ got/got.c @@ -3903,7 +3903,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) @@ -3917,10 +3917,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)