commit b3fabc965e73df1255fb6fe1c1ca6d3452a6264e from: Omar Polo date: Fri Apr 26 09:40:47 2024 UTC got-notify-http: consistetly use fatal instead of err commit - 8aebbd0a7057d6129ac03dd30732374167048488 commit + b3fabc965e73df1255fb6fe1c1ca6d3452a6264e blob - 355860a4ba48913006fd6f5b8ea81ed2d3ab94b5 blob + 67a9f9676ed29a79b0958dbcc5feedfe5137eec0 --- gotd/libexec/got-notify-http/got-notify-http.c +++ gotd/libexec/got-notify-http/got-notify-http.c @@ -89,7 +89,7 @@ dial(const char *host, const char *port) freeaddrinfo(res0); if (s == -1) - err(1, "%s", cause); + fatal("%s", cause); return s; } @@ -309,7 +309,7 @@ jsonify_commit(FILE *fp, const char *repo, char **line author = strdup(l); if (author == NULL) - err(1, "strdup"); + fatal("strdup"); json_author(fp, "author", l, 1); @@ -326,7 +326,7 @@ jsonify_commit(FILE *fp, const char *repo, char **line } if (author == NULL) /* impossible */ - err(1, "from not specified"); + fatalx("from not specified"); json_author(fp, "committer", author, 1); free(author); author = NULL; @@ -548,9 +548,9 @@ jsonify_commit(FILE *fp, const char *repo, char **line } } if (ferror(stdin)) - err(1, "getline"); + fatalx("getline"); if (!done) - errx(1, "%s: unexpected EOF", __func__); + fatalx("%s: unexpected EOF", __func__); fputc('}', fp); return 0; @@ -679,9 +679,9 @@ jsonify_tag(FILE *fp, const char *repo, char **line, s } } if (ferror(stdin)) - err(1, "getline"); + fatal("getline"); if (!done) - errx(1, "%s: unexpected EOF", __func__); + fatalx("%s: unexpected EOF", __func__); fputc('}', fp); return 0; @@ -709,32 +709,32 @@ jsonify(FILE *fp, const char *repo) if (strncmp(line, "Removed refs/heads/", 19) == 0) { if (jsonify_branch_rm(fp, line, repo) == -1) - err(1, "jsonify_branch_rm"); + fatal("jsonify_branch_rm"); continue; } if (strncmp(line, "commit ", 7) == 0) { if (jsonify_commit(fp, repo, &line, &linesize) == -1) - err(1, "jsonify_commit"); + fatal("jsonify_commit"); continue; } if (*line >= '0' && *line <= '9') { if (jsonify_commit_short(fp, line, repo) == -1) - err(1, "jsonify_commit_short"); + fatal("jsonify_commit_short"); continue; } if (strncmp(line, "tag ", 4) == 0) { if (jsonify_tag(fp, repo, &line, &linesize) == -1) - err(1, "jsonify_tag"); + fatal("jsonify_tag"); continue; } errx(1, "unexpected line: %s", line); } if (ferror(stdin)) - err(1, "getline"); + fatal("getline"); fprintf(fp, "]}"); return 0; @@ -771,7 +771,7 @@ basic_auth(const char *username, const char *password) r = asprintf(&str, "%s:%s", username, password); if (r == -1) - err(1, "asprintf"); + fatal("asprintf"); /* * Will need 4 * r/3 bytes to encode the string, plus a @@ -783,7 +783,7 @@ basic_auth(const char *username, const char *password) tmp = calloc(1, len); if (tmp == NULL) - err(1, "malloc"); + fatal("calloc"); s = str; p = tmp;