Signed-off-by: David Wagner <david.wag...@free-electrons.com> --- tools/mkenvimage.c | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/tools/mkenvimage.c b/tools/mkenvimage.c index fa6eb6e..8ba63d2 100644 --- a/tools/mkenvimage.c +++ b/tools/mkenvimage.c @@ -261,11 +261,15 @@ int main(int argc, char **argv) if (redundant) *(dataptr + sizeof(targetendian_crc)) = 1; - bin_fd = creat(bin_filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); - if (bin_fd == -1) { - fprintf(stderr, "Can't open output file \"%s\": %s\n", - bin_filename, strerror(errno)); - return EXIT_FAILURE; + if (!bin_filename || strcmp(bin_filename, "-") == 0) { + bin_fd = STDOUT_FILENO; + } else { + bin_fd = creat(bin_filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); + if (bin_fd == -1) { + fprintf(stderr, "Can't open output file \"%s\": %s\n", + bin_filename, strerror(errno)); + return EXIT_FAILURE; + } } if (write(bin_fd, dataptr, sizeof(*dataptr) * datasize) != -- 1.7.7.3 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot