summaryrefslogtreecommitdiff
path: root/sys/src/cmd/patch.c
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2022-10-03 05:51:21 +0000
committerMichael Forney <mforney@mforney.org>2022-10-03 05:51:21 +0000
commit3ebeabebde7cb1758666cab32a73658f516bb199 (patch)
tree21827cff89c1debcaa73c7a0ef6daeccda0a025a /sys/src/cmd/patch.c
parent87398fde457aab2082f3c07678f35004e19569be (diff)
patch: make slurp() return void
It sysfatals if it fails and has no non-success returns.
Diffstat (limited to 'sys/src/cmd/patch.c')
-rw-r--r--sys/src/cmd/patch.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/src/cmd/patch.c b/sys/src/cmd/patch.c
index 394f4bfc0..7b25285cb 100644
--- a/sys/src/cmd/patch.c
+++ b/sys/src/cmd/patch.c
@@ -459,7 +459,7 @@ Free:
free(changed);
}
-int
+void
slurp(Fbuf *f, char *path)
{
int n, i, fd, sz, len, nlines, linesz;
@@ -502,7 +502,6 @@ slurp(Fbuf *f, char *path)
f->lines = lines;
f->nlines = nlines;
f->lastln = -1;
- return 0;
}
char*
@@ -569,8 +568,8 @@ apply(Patch *p, char *fname)
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;
}