fixed harmless dd double close of stdout (#436368)
This commit is contained in:
parent
1ecd64d157
commit
4d6a38f126
45
coreutils-dddoubleclose.patch
Normal file
45
coreutils-dddoubleclose.patch
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
diff -urNp coreutils-6.10-orig/src/dd.c coreutils-6.10/src/dd.c
|
||||||
|
--- coreutils-6.10-orig/src/dd.c 2007-12-06 14:22:42.000000000 +0100
|
||||||
|
+++ coreutils-6.10/src/dd.c 2008-03-11 12:48:12.000000000 +0100
|
||||||
|
@@ -391,6 +391,25 @@ static char const ebcdic_to_ascii[] =
|
||||||
|
'\070', '\071', '\372', '\373', '\374', '\375', '\376', '\377'
|
||||||
|
};
|
||||||
|
|
||||||
|
+/* True if we need to close the standard output *stream*. */
|
||||||
|
+static bool close_stdout_required = true;
|
||||||
|
+
|
||||||
|
+/* The only reason to close the standard output *stream* is if
|
||||||
|
+ parse_long_options fails (as it does for --help or --version).
|
||||||
|
+ In any other case, dd uses only the STDOUT_FILENO file descriptor,
|
||||||
|
+ and the "cleanup" function calls "close (STDOUT_FILENO)".
|
||||||
|
+ Closing the file descriptor and then letting the usual atexit-run
|
||||||
|
+ close_stdout function call "fclose (stdout)" would result in a
|
||||||
|
+ harmless failure of the close syscall (with errno EBADF).
|
||||||
|
+ This function serves solely to avoid the unnecessary close_stdout
|
||||||
|
+ call, once parse_long_options has succeeded. */
|
||||||
|
+static void
|
||||||
|
+maybe_close_stdout (void)
|
||||||
|
+{
|
||||||
|
+ if (close_stdout_required)
|
||||||
|
+ close_stdout ();
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void
|
||||||
|
usage (int status)
|
||||||
|
{
|
||||||
|
@@ -1639,12 +1658,14 @@ main (int argc, char **argv)
|
||||||
|
textdomain (PACKAGE);
|
||||||
|
|
||||||
|
/* Arrange to close stdout if parse_long_options exits. */
|
||||||
|
- atexit (close_stdout);
|
||||||
|
+ atexit (maybe_close_stdout);
|
||||||
|
|
||||||
|
page_size = getpagesize ();
|
||||||
|
|
||||||
|
parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE, VERSION,
|
||||||
|
usage, AUTHORS, (char const *) NULL);
|
||||||
|
+ close_stdout_required = false;
|
||||||
|
+
|
||||||
|
if (getopt_long (argc, argv, "", NULL, NULL) != -1)
|
||||||
|
usage (EXIT_FAILURE);
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
Summary: The GNU core utilities: a set of tools commonly used in shell scripts
|
Summary: The GNU core utilities: a set of tools commonly used in shell scripts
|
||||||
Name: coreutils
|
Name: coreutils
|
||||||
Version: 6.10
|
Version: 6.10
|
||||||
Release: 11%{?dist}
|
Release: 12%{?dist}
|
||||||
License: GPLv3+
|
License: GPLv3+
|
||||||
Group: System Environment/Base
|
Group: System Environment/Base
|
||||||
Url: http://www.gnu.org/software/coreutils/
|
Url: http://www.gnu.org/software/coreutils/
|
||||||
@ -19,6 +19,7 @@ Source203: coreutils-runuser-l.pamd
|
|||||||
|
|
||||||
# From upstream
|
# From upstream
|
||||||
Patch1: coreutils-6.10-verbose.patch
|
Patch1: coreutils-6.10-verbose.patch
|
||||||
|
Patch2: coreutils-dddoubleclose.patch
|
||||||
|
|
||||||
# Our patches
|
# Our patches
|
||||||
Patch100: coreutils-chgrp.patch
|
Patch100: coreutils-chgrp.patch
|
||||||
@ -97,6 +98,7 @@ cd %name-%version
|
|||||||
|
|
||||||
# From upstream
|
# From upstream
|
||||||
%patch1 -p1 -b .verbose
|
%patch1 -p1 -b .verbose
|
||||||
|
%patch2 -p1 -b .doubleclose
|
||||||
|
|
||||||
# Our patches
|
# Our patches
|
||||||
%patch100 -p1 -b .chgrp
|
%patch100 -p1 -b .chgrp
|
||||||
@ -293,6 +295,9 @@ fi
|
|||||||
/sbin/runuser
|
/sbin/runuser
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Mar 11 2008 Ondrej Vasik <ovasik@redhat.com> - 6.10-12
|
||||||
|
- fixed harmless double close of stdout in dd(#436368)
|
||||||
|
|
||||||
* Thu Mar 6 2008 Ondrej Vasik <ovasik@redhat.com> - 6.10-11
|
* Thu Mar 6 2008 Ondrej Vasik <ovasik@redhat.com> - 6.10-11
|
||||||
- fixed broken order of params in stat(#435669)
|
- fixed broken order of params in stat(#435669)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user