summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Endsley <mendsley@gmail.com>2012-05-13 17:31:26 -0700
committerMatthew Endsley <mendsley@gmail.com>2012-05-14 01:04:24 -0700
commit55a54b19b289f4fdb870ea4effcee208218038df (patch)
tree4bcde4976ad71d7351742e02174c6742ec2e7071
parent2ff07dee98bc4759aae142daada74ac13ad7ff64 (diff)
downloadbsdiff-55a54b19b289f4fdb870ea4effcee208218038df.tar.gz
simply returning -1 on failure in bspatch, and leaving errx calls in main
-rw-r--r--bspatch.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/bspatch.c b/bspatch.c
index 43fc578..3b002cd 100644
--- a/bspatch.c
+++ b/bspatch.c
@@ -86,18 +86,18 @@ int bspatch(const struct bspatch_request req)
for(i=0;i<=2;i++) {
lenread = req.control.read(&req.control, buf, 8);
if (lenread != 8)
- errx(1, "Corrupt patch\n");
+ return -1;
ctrl[i]=offtin(buf);
};
/* Sanity-check */
if(newpos+ctrl[0]>req.newsize)
- errx(1,"Corrupt patch\n");
+ return -1;
/* Read diff string */
lenread = req.diff.read(&req.diff, req.new + newpos, ctrl[0]);
if (lenread != ctrl[0])
- errx(1, "Corrupt patch\n");
+ return -1;
/* Add old data to diff string */
for(i=0;i<ctrl[0];i++)
@@ -110,12 +110,12 @@ int bspatch(const struct bspatch_request req)
/* Sanity-check */
if(newpos+ctrl[1]>req.newsize)
- errx(1,"Corrupt patch\n");
+ return -1;
/* Read extra string */
lenread = req.extra.read(&req.extra, req.new + newpos, ctrl[1]);
if (lenread != ctrl[1])
- errx(1, "Corrupt patch\n");
+ return -1;
/* Adjust pointers */
newpos+=ctrl[1];