rpms/coreutils/devel coreutils-dddoubleclose.patch, NONE, 1.1 coreutils.spec, 1.198, 1.199
Ondrej Vasik (ovasik)
fedora-extras-commits at redhat.com
Tue Mar 11 12:26:57 UTC 2008
- Previous message (by thread): rpms/vorbis-tools/devel vorbis-tools.spec, 1.32, 1.33 vorbis-tools-svn20070412-libcurl.patch, 1.1, NONE vorbis-tools-svn20070412-oggdec.patch, 1.1, NONE
- Next message (by thread): rpms/vorbis-tools/devel .cvsignore,1.6,1.7 sources,1.6,1.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: ovasik
Update of /cvs/extras/rpms/coreutils/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv17353
Modified Files:
coreutils.spec
Added Files:
coreutils-dddoubleclose.patch
Log Message:
fixed harmless dd double close of stdout (#436368)
coreutils-dddoubleclose.patch:
--- NEW FILE coreutils-dddoubleclose.patch ---
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);
Index: coreutils.spec
===================================================================
RCS file: /cvs/extras/rpms/coreutils/devel/coreutils.spec,v
retrieving revision 1.198
retrieving revision 1.199
diff -u -r1.198 -r1.199
--- coreutils.spec 6 Mar 2008 12:21:32 -0000 1.198
+++ coreutils.spec 11 Mar 2008 12:26:21 -0000 1.199
@@ -1,7 +1,7 @@
Summary: The GNU core utilities: a set of tools commonly used in shell scripts
Name: coreutils
Version: 6.10
-Release: 11%{?dist}
+Release: 12%{?dist}
License: GPLv3+
Group: System Environment/Base
Url: http://www.gnu.org/software/coreutils/
@@ -19,6 +19,7 @@
# From upstream
Patch1: coreutils-6.10-verbose.patch
+Patch2: coreutils-dddoubleclose.patch
# Our patches
Patch100: coreutils-chgrp.patch
@@ -97,6 +98,7 @@
# From upstream
%patch1 -p1 -b .verbose
+%patch2 -p1 -b .doubleclose
# Our patches
%patch100 -p1 -b .chgrp
@@ -293,6 +295,9 @@
/sbin/runuser
%changelog
+* Tue Mar 11 2008 Ondrej Vasik <ovasik at redhat.com> - 6.10-12
+- fixed harmless double close of stdout in dd(#436368)
+
* Thu Mar 6 2008 Ondrej Vasik <ovasik at redhat.com> - 6.10-11
- fixed broken order of params in stat(#435669)
- Previous message (by thread): rpms/vorbis-tools/devel vorbis-tools.spec, 1.32, 1.33 vorbis-tools-svn20070412-libcurl.patch, 1.1, NONE vorbis-tools-svn20070412-oggdec.patch, 1.1, NONE
- Next message (by thread): rpms/vorbis-tools/devel .cvsignore,1.6,1.7 sources,1.6,1.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list