--- src/dd.c_ 2007-01-06 04:39:41.000000000 +0200 +++ src/dd.c 2007-01-06 04:41:58.000000000 +0200 @@ -396,6 +396,11 @@ void usage (int status) { + /* usage is the only function that uses stdout --- so set close callback here. + close_stdout can't be called on normal dd branch because it would report + failure because of close (STDOUT_FILENO) */ + atexit (close_stdout); + if (status != EXIT_SUCCESS) fprintf (stderr, _("Try `%s --help' for more information.\n"), program_name); @@ -1636,9 +1641,6 @@ bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); - /* Arrange to close stdout if parse_long_options exits. */ - atexit (close_stdout); - page_size = getpagesize (); parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE, VERSION,