void-packages/srcpkgs/sbsigntool/patches/sbsign_check_write_return.patch
2019-04-18 12:58:10 -03:00

52 lines
1.5 KiB
Diff

Index: sbsigntool/src/sbsign.c
===================================================================
--- sbsigntool.orig/src/sbsign.c
+++ sbsigntool/src/sbsign.c
@@ -242,12 +242,12 @@ int main(int argc, char **argv)
for (i = 0; !image_get_signature(ctx->image, i, &buf, &len); i++)
;
- image_write_detached(ctx->image, i - 1, ctx->outfilename);
+ rc = image_write_detached(ctx->image, i - 1, ctx->outfilename);
} else
- image_write(ctx->image, ctx->outfilename);
+ rc = image_write(ctx->image, ctx->outfilename);
talloc_free(ctx);
- return EXIT_SUCCESS;
+ return (rc == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
Index: sbsigntool/src/fileio.c
===================================================================
--- sbsigntool.orig/src/fileio.c
+++ sbsigntool/src/fileio.c
@@ -201,12 +201,12 @@ int fileio_write_file(const char *filena
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (fd < 0) {
- perror("open");
+ perror("fileio_write_file/open");
return -1;
}
if (!write_all(fd, buf, len)) {
- perror("write_all");
+ perror("fileio_write_file/write_all");
close(fd);
return -1;
}
Index: sbsigntool/src/image.c
===================================================================
--- sbsigntool.orig/src/image.c
+++ sbsigntool/src/image.c
@@ -658,7 +658,7 @@ int image_write(struct image *image, con
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (fd < 0) {
- perror("open");
+ perror("image_write/open");
return -1;
}