commit bafaf650cf9ee98df6390dc7b731fcf9546fb714 from: Christian Weisgerber via: Thomas Adam date: Sat May 14 23:05:46 2022 UTC got patch: switch from fseek() to fseeko(), use unary minus while here ok op commit - 88c260f4a8605679ac53139d0e8f8d7617d68ea9 commit + bafaf650cf9ee98df6390dc7b731fcf9546fb714 blob - 86f80b3ecac7e61aabf96d11efa5bafe09c3114d blob + b8905674bba37940821ad62fa951f062eb2f9093 --- lib/patch.c +++ lib/patch.c @@ -293,8 +293,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); @@ -359,8 +359,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); @@ -488,8 +488,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 - 4311a8209bec2cca71eb9926a09a36a884ee5eac blob + 054a99b50f0835f1ab90b05dabba1586da811977 --- libexec/got-read-patch/got-read-patch.c +++ libexec/got-read-patch/got-read-patch.c @@ -180,8 +180,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; } } @@ -351,8 +351,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; }