--- trunk/mkinitrd-magellan/busybox/coreutils/cksum.c 2010/04/29 20:38:48 983 +++ trunk/mkinitrd-magellan/busybox/coreutils/cksum.c 2010/05/30 11:32:42 984 @@ -4,8 +4,8 @@ * * Copyright (C) 2006 by Rob Sullivan, with ideas from code by Walter Harms * - * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */ - + * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. + */ #include "libbb.h" int cksum_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; @@ -15,6 +15,7 @@ uint32_t crc; off_t length, filesize; int bytes_read; + int exit_code = EXIT_SUCCESS; uint8_t *cp; #if ENABLE_DESKTOP @@ -27,8 +28,10 @@ do { int fd = open_or_warn_stdin(*argv ? *argv : bb_msg_standard_input); - if (fd < 0) + if (fd < 0) { + exit_code = EXIT_FAILURE; continue; + } crc = 0; length = 0; @@ -60,5 +63,5 @@ crc, filesize, *argv); } while (*argv && *++argv); - fflush_stdout_and_exit(EXIT_SUCCESS); + fflush_stdout_and_exit(exit_code); }