diff options
author | Matthew Endsley <mendsley@gmail.com> | 2012-05-13 17:31:26 -0700 |
---|---|---|
committer | Matthew Endsley <mendsley@gmail.com> | 2012-05-14 01:04:24 -0700 |
commit | 55a54b19b289f4fdb870ea4effcee208218038df (patch) | |
tree | 4bcde4976ad71d7351742e02174c6742ec2e7071 | |
parent | 2ff07dee98bc4759aae142daada74ac13ad7ff64 (diff) | |
download | bsdiff-55a54b19b289f4fdb870ea4effcee208218038df.tar.gz |
simply returning -1 on failure in bspatch, and leaving errx calls in main
-rw-r--r-- | bspatch.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -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]; |