Felix Singer has uploaded this change for review.
[WIP] Allow writing to stdout with --read
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Change-Id: If11a2fa4de843446aa831418b40df3699eddc16f
---
M helpers_fileio.c
1 file changed, 17 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/68/68368/1
diff --git a/helpers_fileio.c b/helpers_fileio.c
index cb7675d..43d39af 100644
--- a/helpers_fileio.c
+++ b/helpers_fileio.c
@@ -92,7 +92,13 @@
msg_gerr("No filename specified.\n");
return 1;
}
- if ((image = fopen(filename, "wb")) == NULL) {
+
+ if (!strcmp(filename, "-"))
+ image = fdopen(fileno(stdout), "wb");
+ else
+ image = fopen(filename, "wb");
+
+ if (!image) {
msg_gerr("Error: opening file \"%s\" failed: %s\n", filename, strerror(errno));
return 1;
}
To view, visit change 68368. To unsubscribe, or for help writing mail filters, visit settings.