summaryrefslogtreecommitdiffstats
path: root/misc-utils/mcookie.c
diff options
context:
space:
mode:
Diffstat (limited to 'misc-utils/mcookie.c')
-rw-r--r--misc-utils/mcookie.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/misc-utils/mcookie.c b/misc-utils/mcookie.c
index 5bef4c541..b10f5c6fa 100644
--- a/misc-utils/mcookie.c
+++ b/misc-utils/mcookie.c
@@ -21,6 +21,8 @@
#include "c.h"
#include "md5.h"
#include "nls.h"
+#include "closestream.h"
+
#include <fcntl.h>
#include <getopt.h>
#include <stddef.h>
@@ -102,6 +104,7 @@ int main(int argc, char **argv)
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
+ atexit(close_stdout);
while ((c =
getopt_long(argc, argv, "f:vVh", longopts, NULL)) != -1)
@@ -183,13 +186,5 @@ int main(int argc, char **argv)
printf("%02x", digest[i]);
putchar('\n');
- /*
- * The following is important for cases like disk full,
- * so shell scripts can bomb out properly rather than
- * think they succeeded.
- */
- if (fflush(stdout) < 0 || fclose(stdout) < 0)
- return EXIT_FAILURE;
-
return EXIT_SUCCESS;
}