Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
*
* 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;
argv += optind;
if (argv[0]) {
+ int fd;
if (argv[1])
sfx = argv[1];
- xmove_fd(xopen(argv[0], O_RDONLY), 0);
+ fd = open_or_warn_stdin(argv[0]);
+ if (fd == -1)
+ return EXIT_FAILURE;
+ xmove_fd(fd, STDIN_FILENO);
} else {
argv[0] = (char *) bb_msg_standard_input;
}