commit e45f7eba7c3fe929b6bd5852f390301aeace98aa from: Christian Weisgerber date: Sat May 14 18:55:37 2022 UTC got patch: switch from fseek() to fseeko(), use unary minus while here ok op commit - be33dff7fa389c620154dc06efbeae69bd002950 commit + e45f7eba7c3fe929b6bd5852f390301aeace98aa blob - d7d7afe8b98daec948e859725cc2686ec675b8f5 blob + 3ed493e1548c3314613c3fc0bee9db8553a9b33a --- lib/patch.c +++ lib/patch.c @@ -296,8 +296,8 @@ copy(FILE *tmp, FILE *orig, off_t copypos, off_t pos) char buf[BUFSIZ]; size_t len, r, w; - if (fseek(orig, copypos, SEEK_SET) == -1) - return got_error_from_errno("fseek"); + if (fseeko(orig, copypos, SEEK_SET) == -1) + return got_error_from_errno("fseeko"); while (pos == -1 || copypos < pos) { len = sizeof(buf); @@ -362,8 +362,8 @@ locate_hunk(FILE *orig, struct got_patch_hunk *h, off_ if (err == NULL) { *pos = match; *lineno = match_lineno; - if (fseek(orig, match, SEEK_SET) == -1) - err = got_error_from_errno("fseek"); + if (fseeko(orig, match, SEEK_SET) == -1) + err = got_error_from_errno("fseeko"); } free(line); @@ -491,8 +491,8 @@ patch_file(struct got_patch *p, const char *path, FILE * try to apply the hunk again starting the search * after the previous partial match. */ - if (fseek(orig, pos, SEEK_SET) == -1) { - err = got_error_from_errno("fseek"); + if (fseeko(orig, pos, SEEK_SET) == -1) { + err = got_error_from_errno("fseeko"); goto done; } linelen = getline(&line, &linesize, orig); blob - 96d97895737dd64fc733a5a4dcbcc4b195ffe58e blob + 0e9106ae59e928cb2940be6f14a61271e7d97522 --- libexec/got-read-patch/got-read-patch.c +++ libexec/got-read-patch/got-read-patch.c @@ -181,8 +181,8 @@ find_patch(int *done, FILE *fp) break; /* rewind to previous line */ - if (fseek(fp, linelen * -1, SEEK_CUR) == -1) - err = got_error_from_errno("fseek"); + if (fseeko(fp, -linelen, SEEK_CUR) == -1) + err = got_error_from_errno("fseeko"); break; } } @@ -352,8 +352,8 @@ parse_hunk(FILE *fp, int *done) if (err) goto done; if (*done) { - if (fseek(fp, linelen * -1, SEEK_CUR) == -1) - err = got_error_from_errno("fseek"); + if (fseeko(fp, -linelen, SEEK_CUR) == -1) + err = got_error_from_errno("fseeko"); goto done; }