ref: 3ebeabebde7cb1758666cab32a73658f516bb199
parent: 87398fde457aab2082f3c07678f35004e19569be
author: Michael Forney <mforney@mforney.org>
date: Mon Oct 3 01:51:21 EDT 2022
patch: make slurp() return void It sysfatals if it fails and has no non-success returns.
--- a/sys/src/cmd/patch.c
+++ b/sys/src/cmd/patch.c
@@ -459,7 +459,7 @@
free(changed);
}
-int
+void
slurp(Fbuf *f, char *path)
{
int n, i, fd, sz, len, nlines, linesz;
@@ -502,7 +502,6 @@
f->lines = lines;
f->nlines = nlines;
f->lastln = -1;
- return 0;
}
char*
@@ -569,8 +568,8 @@
for(i = 0; i < p->nhunk; i++){
h = &p->hunk[i];
if(curfile == nil || strcmp(curfile, h->newpath) != 0){
- if(!dryrun && slurp(&f, h->oldpath) == -1)
- sysfatal("slurp %s: %r", h->oldpath);
+ if(!dryrun)
+ slurp(&f, h->oldpath);
curfile = h->newpath;
e = f.buf;
}