rpms/ghostscript/devel ghostscript-mkstemp64.patch, NONE, 1.1 ghostscript.spec, 1.142, 1.143

Tim Waugh (twaugh) fedora-extras-commits at redhat.com
Thu Sep 27 11:06:06 UTC 2007


Author: twaugh

Update of /cvs/pkgs/rpms/ghostscript/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv10098

Modified Files:
	ghostscript.spec 
Added Files:
	ghostscript-mkstemp64.patch 
Log Message:
* Thu Sep 27 2007 Tim Waugh <twaugh at redhat.com> 8.60-3
- Back-ported mkstemp64 patch (bug #308211).


ghostscript-mkstemp64.patch:

--- NEW FILE ghostscript-mkstemp64.patch ---
From: alexcher <alexcher at a1074d23-0009-0410-80fe-cf8c14f379e6>
Date: Sat, 8 Sep 2007 22:31:20 +0000 (+0000)
Subject: Declare Ghostscript as _LARGEFILE64_SOURCE program, i.e. request transitional
X-Git-Url: http://git.infradead.org/?p=ghostscript.git;a=commitdiff_plain;h=0513d1b9542d37e7134d36e49222b12ef469b722

Declare Ghostscript as _LARGEFILE64_SOURCE program, i.e. request transitional
interface to large file support. Check for mkstemp64() availability specially.


git-svn-id: http://svn.ghostscript.com/ghostscript/trunk/gs@8232 a1074d23-0009-0410-80fe-cf8c14f379e6
---

diff --git a/src/Makefile.in b/src/Makefile.in
index c1e3c3b..5590f9a 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -120,8 +120,11 @@ GENOPT=
 #
 # -DHAVE_FILE64
 #	use marked versions of the stdio FILE calls, fopen64() et al.
+#
+# -DHAVE_MKSTEMP64
+#	use non-standard function mkstemp64()
 
-CAPOPT= @HAVE_MKSTEMP@ @HAVE_HYPOT@ @HAVE_FILE64@ @HAVE_FONTCONFIG@
+CAPOPT= @HAVE_MKSTEMP@ @HAVE_HYPOT@ @HAVE_FILE64@ @HAVE_MKSTEMP64@ @HAVE_FONTCONFIG@
 
 # Define the name of the executable file.
 
diff --git a/src/configure.ac b/src/configure.ac
index 10658c5..ffde250 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -924,6 +924,9 @@ AC_SUBST(HAVE_HYPOT)
 AC_CHECK_FUNCS([fopen64], [HAVE_FILE64=-DHAVE_FILE64])
 AC_SUBST(HAVE_FILE64)
 
+AC_CHECK_FUNCS([mkstemp64], [HAVE_MKSTEMP64=-DHAVE_MKSTEMP64])
+AC_SUBST(HAVE_MKSTEMP64)
+
 AC_PROG_GCC_TRADITIONAL
 
 dnl NB: We don't actually provide autoconf-switched fallbacks for any
diff --git a/src/gp_unifs.c b/src/gp_unifs.c
index 6b6a85c..ac555b5 100644
--- a/src/gp_unifs.c
+++ b/src/gp_unifs.c
@@ -88,18 +88,22 @@ gp_open_scratch_file_generic(const char *prefix, char fname[gp_file_name_sizeof]
 
 	/* save the old filename template in case mkstemp fails */
 	memcpy(ofname, fname, gp_file_name_sizeof);
-#if defined(HAVE_FILE64) && !defined(_LARGEFILE64_SOURCE)
-	if (b64)
-	    file = mkstemp64(fname);
-	else
+#ifdef HAVE_MKSTEMP64
+	file = (b64 ? mkstemp64 : mkstemp)(fname);
+#else
+        file = mkstemp(fname);
 #endif
-	    file = mkstemp(fname);
-
-	/* Fixme : what to do with b64 and 32-bit mkstemp? Unimplemented. */
 	if (file < -1) {
 	    eprintf1("**** Could not open temporary file %s\n", ofname);
 	    return NULL;
 	}
+#if defined(O_LARGEFILE) && defined(__hpux)
+        if (b64)
+            fcntl(file, F_SETFD, fcntl(file, F_GETFD) | O_LARGEFILE);
+#else
+	/* Fixme : what to do with b64 and 32-bit mkstemp? Unimplemented. */
+#endif
+
 	fp = fdopen(file, mode);
 	if (fp == NULL)
 	    close(file);
@@ -479,10 +483,10 @@ gp_enumerate_files_close(file_enum * pfen)
 
 FILE *gp_fopen_64(const char *filename, const char *mode)
 {
-#if defined(_LARGEFILE64_SOURCE) || !defined(HAVE_FILE64)
-    return fopen(filename, mode);
-#else
+#if defined(HAVE_FILE64)
     return fopen64(filename, mode);
+#else
+    return fopen(filename, mode);
 #endif
 }
 
@@ -497,22 +501,22 @@ FILE *gp_open_scratch_file_64(const char *prefix,
 
 int64_t gp_ftell_64(FILE *strm)
 {
-#if defined(_LARGEFILE64_SOURCE) || !defined(HAVE_FILE64)
-    return ftello(strm);
-#else
+#if defined(HAVE_FILE64)
     return ftello64(strm);
+#else
+    return ftello(strm);
 #endif
 }
 
 int gp_fseek_64(FILE *strm, int64_t offset, int origin)
 {
-#if defined(_LARGEFILE64_SOURCE) || !defined(HAVE_FILE64)
+#if defined(HAVE_FILE64)
+    return fseeko64(strm, offset, origin);
+#else
     off_t offset1 = (off_t)offset;
     
     if (offset != offset1)
 	return -1;
     return fseeko(strm, offset1, origin);
-#else
-    return fseeko64(strm, offset, origin);
 #endif
 }
diff --git a/src/stdpre.h b/src/stdpre.h
index acb61c1..c17cdbf 100644
--- a/src/stdpre.h
+++ b/src/stdpre.h
@@ -17,6 +17,9 @@
 #ifndef stdpre_INCLUDED
 #  define stdpre_INCLUDED
 
+/* Ghostscript uses transitional LFS functions. */
+#define _LARGEFILE64_SOURCE 1
+
 /*
  * Here we deal with the vagaries of various C compilers.  We assume that:
  *      ANSI-standard Unix compilers define __STDC__.


Index: ghostscript.spec
===================================================================
RCS file: /cvs/pkgs/rpms/ghostscript/devel/ghostscript.spec,v
retrieving revision 1.142
retrieving revision 1.143
diff -u -r1.142 -r1.143
--- ghostscript.spec	23 Aug 2007 16:14:00 -0000	1.142
+++ ghostscript.spec	27 Sep 2007 11:05:26 -0000	1.143
@@ -5,7 +5,7 @@
 Name: ghostscript
 Version: %{gs_ver}
 
-Release: 2%{?dist}
+Release: 3%{?dist}
 
 License: GPLv2
 URL: http://www.ghostscript.com/
@@ -20,6 +20,7 @@
 Patch3: ghostscript-noopt.patch
 Patch4: ghostscript-fPIC.patch
 Patch5: http://www.openprinting.org/download/printing/esp-gpl-ghostscript-merge/ghostscript-8.57-ijs-krgb.patch
+Patch6: ghostscript-mkstemp64.patch
 
 Requires: urw-fonts >= 1.1, ghostscript-fonts
 BuildRequires: libjpeg-devel, libXt-devel
@@ -88,6 +89,8 @@
 # IJS KRGB patch.
 %patch5 -p1 -b .ijs-krgb
 
+%patch6 -p1 -b .mkstemp64
+
 # Convert manual pages to UTF-8
 from8859_1() {
 	iconv -f iso-8859-1 -t utf-8 < "$1" > "${1}_"
@@ -265,6 +268,9 @@
 %{_libdir}/libgs.so
 
 %changelog
+* Thu Sep 27 2007 Tim Waugh <twaugh at redhat.com> 8.60-3
+- Back-ported mkstemp64 patch (bug #308211).
+
 * Thu Aug 23 2007 Tim Waugh <twaugh at redhat.com> 8.60-2
 - More specific license tag.
 




More information about the fedora-extras-commits mailing list