[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

X Strike Force XFree86 SVN commit: r2265 - in trunk/debian: . patches



Author: branden
Date: 2005-05-17 13:42:51 -0500 (Tue, 17 May 2005)
New Revision: 2265

Removed:
   trunk/debian/patches/099za_libxpm_spopen_fix.diff
Modified:
   trunk/debian/TODO
Log:
Remove David Nusinow's patch which fails to apply, has patches already
applied, and includes changes not relevant to fixing s_popen().

Update TODO to describe in detail how we should backport this patch.

Add item: a separate, non-security fix to Xpm that is probably important
but should be run by the Release Managers. See <URL:
https://bugs.freedesktop.org/show_bug.cgi?id=830 >.


Modified: trunk/debian/TODO
===================================================================
--- trunk/debian/TODO	2005-05-17 18:09:25 UTC (rev 2264)
+++ trunk/debian/TODO	2005-05-17 18:42:51 UTC (rev 2265)
@@ -17,8 +17,37 @@
 4.3.0.dfsg.1-14
 ---------------
 * Get fix for Spanish debconf template translations from Steve Langasek.
-* Tidy up latest libXpm fix (s_popen flaw).
+* Grab Xpm library fixes from freedesktop.org xorg CVS:
+    * xc/extras/Xpm/lib/xpm.h
+      Bugzilla #830 (https://bugs.freedesktop.org/show_bug.cgi?id=830)
+      attachment #1493 (https://bugs.freedesktop.org/attachment.cgi?id=1493):
+      Fix libXpm header (xpm.h) to use the X11 function begin/end marker
+      macros (_XFUNCPROTOBEGIN, _XFUNCPROTOEND) instead of homegrown
+      (native) C++ code.
+      Patch by Kevin DeKorte <kdekorte@yahoo.com>.
 
+    Changes needed:
+        xc/extras/Xpm/lib/xpm.h                 1.2 -> 1.3
+
+  + Replace security-flawed s_popen() fix for CAN-2004-0914 with better fix by
+    Alex Reisen and Matthieu Herrb.
+    * extras/Xpm/lib/RdFToI.c:
+    * extras/Xpm/lib/WrFFrI.c:
+    * lib/Xpm/Imakefile:
+      Replace s_popen() by a more specific function that allows only
+      one command in the pipe. Remove extraneous tests on file names
+      that broke some applications. From Alex Reisen in Bugzilla #1920.
+    * more s_open() cleanup.
+    * Fix incomplete merge.
+    * Remove s_open.c references in (unused) Imakefile too.
+
+    Changes needed:
+        xc/extras/Xpm/lib/RdFToI.c              1.3 -> 1.6
+        xc/extras/Xpm/lib/WrFFrI.c              1.4 -> 1.5
+        xc/extras/Xpm/lib/s_popen.c             DELETE
+        xc/extras/Xpm/Imakefile                 1.2 -> 1.3
+        xc/lib/Xpm/Imakefile                    1.4 -> 1.5
+
 Post 4.3.0-1
 ------------
 * Rewrite xserver-xfree86 debconfage, possibly as xserver-xorg debconfage.  Joey

Deleted: trunk/debian/patches/099za_libxpm_spopen_fix.diff
===================================================================
--- trunk/debian/patches/099za_libxpm_spopen_fix.diff	2005-05-17 18:09:25 UTC (rev 2264)
+++ trunk/debian/patches/099za_libxpm_spopen_fix.diff	2005-05-17 18:42:51 UTC (rev 2265)
@@ -1,651 +0,0 @@
-diff -ruN xc-old/extras/Xpm/cxpm/cxpm.c xc/extras/Xpm/cxpm/cxpm.c
---- xc-old/extras/Xpm/cxpm/cxpm.c	2001-07-31 20:44:34.000000000 -0400
-+++ xc/extras/Xpm/cxpm/cxpm.c	2005-05-14 16:16:52.000000000 -0400
-@@ -47,8 +47,9 @@
-  * note that 's' could stand both for "special" and "slow" ;-)
-  */
- static int
--sGetc(data)
-+sGetc(data, file)
-     xpmData *data;
-+    FILE *file;
- {
-     int c = getc(data->stream.file);
-     if (c == '\n') {
-@@ -61,9 +62,10 @@
- }
- 
- static void
--sUngetc(data, c)
-+sUngetc(data, c, file)
-     xpmData *data;
-     int c;
-+    FILE *file;
- {
-     ungetc(c, data->stream.file);
-     if (c == '\n') {
-diff -ruN xc-old/extras/Xpm/lib/create.c xc/extras/Xpm/lib/create.c
---- xc-old/extras/Xpm/lib/create.c	2005-05-14 15:57:06.000000000 -0400
-+++ xc/extras/Xpm/lib/create.c	2005-05-14 16:16:52.000000000 -0400
-@@ -1,4 +1,4 @@
--/* $XdotOrg: pre-CVS proposed fix for CESA-2004-003 alanc 7/25/2004 $ */
-+/* $XdotOrg: xc/extras/Xpm/lib/create.c,v 1.2.4.2 2004/12/17 01:09:36 gisburn Exp $ */
- /*
-  * Copyright (C) 1989-95 GROUPE BULL
-  *
-@@ -33,7 +33,7 @@
- *                                                                             *
- *  Developed by Arnaud Le Hors                                                *
- \*****************************************************************************/
--/* $XFree86: xc/extras/Xpm/lib/create.c,v 1.3 2002/01/07 19:40:49 dawes Exp $ */
-+/* $XFree86: xc/extras/Xpm/lib/create.c,v 1.4 2003/05/27 22:26:20 tsi Exp $ */
- 
- /*
-  * The code related to FOR_MSW has been added by
-@@ -129,7 +129,9 @@
- 
- LFUNC(PutPixel1, int, (XImage *ximage, int x, int y, unsigned long pixel));
- LFUNC(PutPixel, int, (XImage *ximage, int x, int y, unsigned long pixel));
-+#if !defined(WORD64) && !defined(LONG64)
- LFUNC(PutPixel32, int, (XImage *ximage, int x, int y, unsigned long pixel));
-+#endif
- LFUNC(PutPixel32MSB, int, (XImage *ximage, int x, int y, unsigned long pixel));
- LFUNC(PutPixel32LSB, int, (XImage *ximage, int x, int y, unsigned long pixel));
- LFUNC(PutPixel16MSB, int, (XImage *ximage, int x, int y, unsigned long pixel));
-@@ -770,7 +772,6 @@
-     unsigned int depth;
-     int bitmap_format;
-     XpmFreeColorsFunc freeColors;
--    void *closure;
- 
-     /* variables to return */
-     XImage *ximage = NULL;
-@@ -817,14 +818,10 @@
- 	freeColors = attributes->free_colors;
-     else
- 	freeColors = FreeColors;
--    if (attributes && (attributes->valuemask & XpmColorClosure))
--	closure = attributes->color_closure;
--    else
--	closure = NULL;
- 
-     ErrorStatus = XpmSuccess;
- 
--    if (image->ncolors >= UINT_MAX / sizeof(Pixel))
-+    if (image->ncolors >= UINT_MAX / sizeof(Pixel)) 
- 	return (XpmNoMemory);
- 
-     /* malloc pixels index tables */
-@@ -1218,10 +1215,10 @@
-     register char *src;
-     register char *dst;
-     register unsigned int *iptr;
--    register unsigned int x, y, i;
-+    register unsigned int x, y;
-     register char *data;
-     Pixel pixel, px;
--    int nbytes, depth, ibu, ibpp;
-+    int nbytes, depth, ibu, ibpp, i;
- 
-     data = image->data;
-     iptr = pixelindex;
-@@ -1832,6 +1829,7 @@
-     return 1;
- }
- 
-+#if !defined(WORD64) && !defined(LONG64)
- static int
- PutPixel32(ximage, x, y, pixel)
-     register XImage *ximage;
-@@ -1848,6 +1846,7 @@
-     *((unsigned long *)addr) = pixel;
-     return 1;
- }
-+#endif
- 
- static int
- PutPixel32MSB(ximage, x, y, pixel)
-@@ -1995,7 +1994,6 @@
-     unsigned int depth;
-     int bitmap_format;
-     XpmFreeColorsFunc freeColors;
--    void *closure;
- 
-     /* variables to return */
-     XImage *ximage = NULL;
-@@ -2053,10 +2051,6 @@
- 	freeColors = attributes->free_colors;
-     else
- 	freeColors = FreeColors;
--    if (attributes && (attributes->valuemask & XpmColorClosure))
--	closure = attributes->color_closure;
--    else
--	closure = NULL;
- 
-     cmts = info && (info->valuemask & XpmReturnComments);
- 
-diff -ruN xc-old/extras/Xpm/lib/Imakefile xc/extras/Xpm/lib/Imakefile
---- xc-old/extras/Xpm/lib/Imakefile	2005-05-14 15:57:06.000000000 -0400
-+++ xc/extras/Xpm/lib/Imakefile	2005-05-14 16:16:52.000000000 -0400
-@@ -104,15 +104,13 @@
- 	 CrBufFrI.c CrDatFrP.c CrPFrBuf.c RdFToI.c WrFFrI.c \
- 	 CrBufFrP.c CrIFrBuf.c CrPFrDat.c RdFToP.c WrFFrP.c \
- 	 CrDatFrI.c CrIFrDat.c RdFToDat.c WrFFrDat.c \
--	 Attrib.c CrIFrP.c CrPFrI.c Image.c Info.c RdFToBuf.c WrFFrBuf.c \
--	 s_popen.c
-+	 Attrib.c CrIFrP.c CrPFrI.c Image.c Info.c RdFToBuf.c WrFFrBuf.c
- 
-   OBJS = data.o create.o misc.o rgb.o scan.o parse.o hashtab.o \
- 	 CrBufFrI.o CrDatFrP.o CrPFrBuf.o RdFToI.o WrFFrI.o \
- 	 CrBufFrP.o CrIFrBuf.o CrPFrDat.o RdFToP.o WrFFrP.o \
- 	 CrDatFrI.o CrIFrDat.o RdFToDat.o WrFFrDat.o \
--	 Attrib.o CrIFrP.o CrPFrI.o Image.o Info.o RdFToBuf.o WrFFrBuf.o \
--	 s_popen.o
-+	 Attrib.o CrIFrP.o CrPFrI.o Image.o Info.o RdFToBuf.o WrFFrBuf.o
- 
-        INCLUDES = -I.
-        LINTLIBS = $(LINTXTOLL) $(LINTXLIB) 
-diff -ruN xc-old/extras/Xpm/lib/RdFToI.c xc/extras/Xpm/lib/RdFToI.c
---- xc-old/extras/Xpm/lib/RdFToI.c	2005-05-14 15:57:06.000000000 -0400
-+++ xc/extras/Xpm/lib/RdFToI.c	2005-05-14 16:16:52.000000000 -0400
-@@ -31,20 +31,16 @@
- *                                                                             *
- *  Developed by Arnaud Le Hors                                                *
- \*****************************************************************************/
--/* $XFree86: xc/extras/Xpm/lib/RdFToI.c,v 1.2 2001/10/28 03:32:09 tsi Exp $ */
-+/* $XFree86$ */
- 
- /* October 2004, source code review by Thomas Biege <thomas@suse.de> */
- 
- #include "XpmI.h"
--#include <sys/stat.h>
--#if !defined(NO_ZPIPE) && defined(WIN32)
--# define popen _popen
--# define pclose _pclose
--# if defined(STAT_ZFILE)
--#  include <io.h>
--#  define stat _stat
--#  define fstat _fstat
--# endif
-+#ifndef NO_ZPIPE
-+#include <fcntl.h>
-+#include <errno.h>
-+#include <sys/types.h>
-+#include <sys/wait.h>
- #endif
- 
- LFUNC(OpenReadFile, int, (char *filename, xpmData *mdata));
-@@ -122,89 +118,131 @@
- }
- #endif /* CXPMPROG */
- 
--/*
-- * open the given file to be read as an xpmData which is returned.
-- */
- #ifndef NO_ZPIPE
--	FILE *s_popen(char *cmd, const char *type);
--#else
--#	define s_popen popen
-+/* Do not depend on errno after read_through */
-+FILE*
-+xpmPipeThrough(fd, cmd, arg1, mode)
-+    int fd;
-+    const char* cmd;
-+    const char* arg1;
-+    const char* mode;
-+{
-+    FILE* fp;
-+    int status, fds[2], in = 0, out = 1;
-+    pid_t pid;
-+    if ( 'w' == *mode )
-+	out = 0, in = 1;
-+    if ( pipe(fds) < 0 )
-+	return NULL;
-+    pid = fork();
-+    if ( pid < 0 )
-+	goto fail1;
-+    if ( 0 == pid )
-+    {
-+	close(fds[in]);
-+	if ( dup2(fds[out], out) < 0 )
-+	    goto err;
-+	close(fds[out]);
-+	if ( dup2(fd, in) < 0 )
-+	    goto err;
-+	close(fd);
-+	pid = fork();
-+	if ( pid < 0 )
-+	    goto err;
-+	if ( 0 == pid )
-+	{
-+	    execlp(cmd, cmd, arg1, NULL);
-+	    perror(cmd);
-+	    goto err;
-+	}
-+	_exit(0);
-+    err:
-+	_exit(1);
-+    }
-+    close(fds[out]);
-+    /* calling process: wait for first child */
-+    while ( waitpid(pid, &status, 0) < 0 && EINTR == errno )
-+	;
-+    if ( WIFSIGNALED(status) ||
-+	 (WIFEXITED(status) && WEXITSTATUS(status) != 0) )
-+	goto fail2;
-+    fp = fdopen(fds[in], mode);
-+    if ( !fp )
-+	goto fail2;
-+    close(fd); /* still open in 2nd child */
-+    return fp;
-+fail1:
-+    close(fds[out]);
-+fail2:
-+    close(fds[in]);
-+    return NULL;
-+}
- #endif
- 
-+/*
-+ * open the given file to be read as an xpmData which is returned.
-+ */
- static int
- OpenReadFile(filename, mdata)
-     char *filename;
-     xpmData *mdata;
- {
--#ifndef NO_ZPIPE
--    char buf[BUFSIZ];
--# ifdef STAT_ZFILE
--    char *compressfile;
--    struct stat status;
--# endif
--#endif
--
-     if (!filename) {
- 	mdata->stream.file = (stdin);
- 	mdata->type = XPMFILE;
-     } else {
--#ifndef NO_ZPIPE
--	size_t len = strlen(filename);
--
--	if (len == 0)
--		return(XpmOpenFailed);
--	if ((len > 2) && !strcmp(".Z", filename + (len - 2))) {
--	    mdata->type = XPMPIPE;
--	    snprintf(buf, sizeof(buf), "uncompress -c \"%s\"", filename);
--	    if (!(mdata->stream.file = s_popen(buf, "r")))
--		return (XpmOpenFailed);
--
--	} else if ((len > 3) && !strcmp(".gz", filename + (len - 3))) {
--	    mdata->type = XPMPIPE;
--	    snprintf(buf, sizeof(buf), "gunzip -qc \"%s\"", filename);
--	    if (!(mdata->stream.file = s_popen(buf, "r")))
--		return (XpmOpenFailed);
--
--	} else {
--# ifdef STAT_ZFILE
--	    if (!(compressfile = (char *) XpmMalloc(len + 4)))
-+	int fd = open(filename, O_RDONLY);
-+#if defined(NO_ZPIPE)
-+	if ( fd < 0 )
-+	    return XpmOpenFailed;
-+#else
-+	const char* ext = NULL;
-+	if ( fd >= 0 )
-+	    ext = strrchr(filename, '.');
-+#ifdef STAT_ZFILE /* searching for z-files if the given name not found */
-+	else
-+	{
-+	    size_t len = strlen(filename);
-+	    char *compressfile = (char *) XpmMalloc(len + 4);
-+	    if ( !compressfile )
- 		return (XpmNoMemory);
--
--	    snprintf(compressfile, len+4, "%s.Z", filename);
--	    if (!stat(compressfile, &status)) {
--		snprintf(buf, sizeof(buf), "uncompress -c \"%s\"", compressfile);
--		if (!(mdata->stream.file = s_popen(buf, "r"))) {
-+	    strcpy(compressfile, filename);
-+	    strcpy(compressfile + len, ext = ".Z");
-+	    fd = open(compressfile, O_RDONLY);
-+	    if ( fd < 0 )
-+	    {
-+		strcpy(compressfile + len, ext = ".gz");
-+		fd = open(compressfile, O_RDONLY);
-+		if ( fd < 0 )
-+		{
- 		    XpmFree(compressfile);
--		    return (XpmOpenFailed);
--		}
--		mdata->type = XPMPIPE;
--	    } else {
--		snprintf(compressfile, len+4, "%s.gz", filename);
--		if (!stat(compressfile, &status)) {
--		    snprintf(buf, sizeof(buf), "gunzip -c \"%s\"", compressfile);
--		    if (!(mdata->stream.file = s_popen(buf, "r"))) {
--			XpmFree(compressfile);
--			return (XpmOpenFailed);
--		    }
--		    mdata->type = XPMPIPE;
--		} else {
--# endif
--#endif
--		    if (!(mdata->stream.file = fopen(filename, "r"))) {
--#if !defined(NO_ZPIPE) && defined(STAT_ZFILE)
--			XpmFree(compressfile);
--#endif
--			return (XpmOpenFailed);
--		    }
--		    mdata->type = XPMFILE;
--#ifndef NO_ZPIPE
--# ifdef STAT_ZFILE
-+		    return XpmOpenFailed;
- 		}
- 	    }
- 	    XpmFree(compressfile);
--# endif
- 	}
- #endif
-+	if ( ext && !strcmp(ext, ".Z") )
-+	{
-+	    mdata->type = XPMPIPE;
-+	    mdata->stream.file = xpmPipeThrough(fd, "uncompress", "-c", "r");
-+	}
-+	else if ( ext && !strcmp(ext, ".gz") )
-+	{
-+	    mdata->type = XPMPIPE;
-+	    mdata->stream.file = xpmPipeThrough(fd, "gunzip", "-qc", "r");
-+	}
-+	else
-+#endif /* z-files */
-+	{
-+	    mdata->type = XPMFILE;
-+	    mdata->stream.file = fdopen(fd, "r");
-+	}
-+	if (!mdata->stream.file)
-+	{
-+	    close(fd);
-+	    return (XpmOpenFailed);
-+	}
-     }
-     mdata->CommentLength = 0;
- #ifdef CXPMPROG
-@@ -221,15 +259,6 @@
- xpmDataClose(mdata)
-     xpmData *mdata;
- {
--    switch (mdata->type) {
--    case XPMFILE:
--	if (mdata->stream.file != (stdin))
--	    fclose(mdata->stream.file);
--	break;
--#ifndef NO_ZPIPE
--    case XPMPIPE:
-+    if (mdata->stream.file != (stdin))
- 	fclose(mdata->stream.file);
--	break;
--#endif
--    }
- }
-diff -ruN xc-old/extras/Xpm/lib/scan.c xc/extras/Xpm/lib/scan.c
---- xc-old/extras/Xpm/lib/scan.c	2005-05-14 15:57:06.000000000 -0400
-+++ xc/extras/Xpm/lib/scan.c	2005-05-14 16:16:52.000000000 -0400
-@@ -621,8 +621,8 @@
-     char *dst;
-     unsigned int *iptr;
-     char *data;
--    unsigned int x, y, i;
--    int bits, depth, ibu, ibpp, offset;
-+    unsigned int x, y;
-+    int bits, depth, ibu, ibpp, offset, i;
-     unsigned long lbt;
-     Pixel pixel, px;
- 
-@@ -633,6 +633,9 @@
-     ibpp = image->bits_per_pixel;
-     offset = image->xoffset;
- 
-+    if (image->bitmap_unit < 0)
-+	    return (XpmNoMemory);
-+
-     if ((image->bits_per_pixel | image->depth) == 1) {
- 	ibu = image->bitmap_unit;
- 	for (y = 0; y < height; y++)
-diff -ruN xc-old/extras/Xpm/lib/WrFFrI.c xc/extras/Xpm/lib/WrFFrI.c
---- xc-old/extras/Xpm/lib/WrFFrI.c	2005-05-14 15:57:06.000000000 -0400
-+++ xc/extras/Xpm/lib/WrFFrI.c	2005-05-14 16:16:52.000000000 -0400
-@@ -31,19 +31,21 @@
- *                                                                             *
- *  Developed by Arnaud Le Hors                                                *
- \*****************************************************************************/
--/* $XFree86: xc/extras/Xpm/lib/WrFFrI.c,v 1.2 2001/10/28 03:32:09 tsi Exp $ */
-+/* $XFree86$ */
- 
- /*
-  * The code related to AMIGA has been added by
-  * Lorens Younes (d93-hyo@nada.kth.se) 4/96
-  */
- 
--/* October 2004, source code review by Thomas Biege <thomas@suse.de> */
--
- #include "XpmI.h"
--#if !defined(NO_ZPIPE) && defined(WIN32)
--# define popen _popen
--# define pclose _pclose
-+
-+#ifndef NO_ZPIPE
-+#include "sys/wait.h"
-+#include "sys/types.h"
-+#include "fcntl.h"
-+#include "unistd.h"
-+#include "errno.h"
- #endif
- 
- /* MS Windows define a function called WriteFile @#%#&!!! */
-@@ -124,7 +126,7 @@
- 	/* let's try to make a valid C syntax name */
- 	if (index(name, '.')) {
- 	    strncpy(new_name, name, sizeof(new_name));
--	    new_name[sizeof(new_name)-1] = 0;
-+	    new_name[sizeof(new_name)-1] = '\0';
- 	    /* change '.' to '_' */
- 	    name = s = new_name;
- 	    while ((dot = index(s, '.'))) {
-@@ -134,8 +136,7 @@
- 	}
- 	if (index(name, '-')) {
- 	    if (name != new_name) {
--		strncpy(new_name, name, sizeof(new_name));
--		new_name[sizeof(new_name)-1] = 0;
-+		strcpy(new_name, name);
- 		name = new_name;
- 	    }
- 	    /* change '-' to '_' */
-@@ -252,8 +253,8 @@
-     unsigned int x, y, h;
- 
-     h = height - 1;
--    if (cpp != 0 && width >= (UINT_MAX - 3)/cpp)
--	return XpmNoMemory;
-+    if (cpp != 0 && width >= (UINT_MAX - 3)/cpp) 
-+	return XpmNoMemory;    
-     p = buf = (char *) XpmMalloc(width * cpp + 3);
-     if (!buf)
- 	return (XpmNoMemory);
-@@ -301,55 +302,48 @@
-     fprintf(file, ",\n\"XPMENDEXT\"");
- }
- 
-+
-+#ifndef NO_ZPIPE
-+FUNC(xpmPipeThrough, FILE*, (int fd,
-+			     const char* cmd,
-+			     const char* arg1,
-+			     const char* mode));
-+#endif
-+
- /*
-  * open the given file to be written as an xpmData which is returned
-  */
--#ifndef NO_ZPIPE
--	FILE *s_popen(char *cmd, const char *type);
--#else
--#	define s_popen popen
--#endif
- static int
- OpenWriteFile(filename, mdata)
-     char *filename;
-     xpmData *mdata;
- {
--#ifndef NO_ZPIPE
--    char buf[BUFSIZ];
--
--#endif
--
-     if (!filename) {
- 	mdata->stream.file = (stdout);
- 	mdata->type = XPMFILE;
-     } else {
- #ifndef NO_ZPIPE
--	size_t len = strlen(filename);
--
--	if (len == 0)
--		return(XpmOpenFailed);
--
-+	size_t len;
-+#endif
-+	int fd = open(filename, O_WRONLY|O_CREAT|O_TRUNC, 0644);
-+	if ( fd < 0 )
-+	    return(XpmOpenFailed);
-+#ifndef NO_ZPIPE
-+	len = strlen(filename);
- 	if (len > 2 && !strcmp(".Z", filename + (len - 2))) {
--	    snprintf(buf, sizeof(buf), "compress > \"%s\"", filename);
--	    if (!(mdata->stream.file = s_popen(buf, "w")))
--		return (XpmOpenFailed);
--
-+	    mdata->stream.file = xpmPipeThrough(fd, "compress", NULL, "w");
- 	    mdata->type = XPMPIPE;
- 	} else if (len > 3 && !strcmp(".gz", filename + (len - 3))) {
--	    snprintf(buf, sizeof(buf), "gzip -q > \"%s\"", filename);
--	    if (!(mdata->stream.file = s_popen(buf, "w")))
--		return (XpmOpenFailed);
--
-+	    mdata->stream.file = xpmPipeThrough(fd, "gzip", "-q", "w");
- 	    mdata->type = XPMPIPE;
--	} else {
-+	} else
- #endif
--	    if (!(mdata->stream.file = fopen(filename, "w")))
--		return (XpmOpenFailed);
--
-+	{
-+	    mdata->stream.file = fdopen(fd, "w");
- 	    mdata->type = XPMFILE;
--#ifndef NO_ZPIPE
- 	}
--#endif
-+	if (!mdata->stream.file)
-+	    return (XpmOpenFailed);
-     }
-     return (XpmSuccess);
- }
-@@ -361,15 +355,7 @@
- xpmDataClose(mdata)
-     xpmData *mdata;
- {
--    switch (mdata->type) {
--    case XPMFILE:
--	if (mdata->stream.file != (stdout))
--	    fclose(mdata->stream.file);
--	break;
--#ifndef NO_ZPIPE
--    case XPMPIPE:
-+    if (mdata->stream.file != (stdout))
- 	fclose(mdata->stream.file);
--	break;
--#endif
--    }
- }
-+
-diff -ruN xc-old/extras/Xpm/lib/xpm.h xc/extras/Xpm/lib/xpm.h
---- xc-old/extras/Xpm/lib/xpm.h	2001-08-22 19:36:44.000000000 -0400
-+++ xc/extras/Xpm/lib/xpm.h	2005-05-14 16:16:52.000000000 -0400
-@@ -85,16 +85,6 @@
- # define PIXEL_ALREADY_TYPEDEFED
- #endif
- 
--/* make sure we know whether function prototypes are needed or not */
--#ifndef NeedFunctionPrototypes
--# if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
--#  define NeedFunctionPrototypes 1
--# else
--#  define NeedFunctionPrototypes 0
--# endif
--#endif
--
--
- /* Return ErrorStatus codes:
-  * null     if full success
-  * positive if partial success
-@@ -150,23 +140,19 @@
- }      XpmInfo;
- 
- typedef int (*XpmAllocColorFunc)(
--#if NeedFunctionPrototypes
-     Display*			/* display */,
-     Colormap			/* colormap */,
-     char*			/* colorname */,
-     XColor*			/* xcolor */,
-     void*			/* closure */
--#endif
- );
- 
- typedef int (*XpmFreeColorsFunc)(
--#if NeedFunctionPrototypes
-     Display*			/* display */,
-     Colormap			/* colormap */,
-     Pixel*			/* pixels */,
-     int				/* npixels */,
-     void*			/* closure */
--#endif
- );
- 
- typedef struct {
-@@ -290,22 +276,15 @@
- 
- 
- /* macros for forward declarations of functions with prototypes */
--#if NeedFunctionPrototypes
- #define FUNC(f, t, p) extern t f p
- #define LFUNC(f, t, p) static t f p
--#else
--#define FUNC(f, t, p) extern t f()
--#define LFUNC(f, t, p) static t f()
--#endif
- 
- 
- /*
-  * functions declarations
-  */
- 
--#ifdef __cplusplus
--extern "C" {
--#endif
-+_XFUNCPROTOBEGIN
- 
- /* FOR_MSW, all ..Pixmap.. are excluded, only the ..XImage.. are used */
- /* Same for Amiga! */
-@@ -459,10 +438,7 @@
- 
-     FUNC(XpmFree, void, (void *ptr));
- 
--#ifdef __cplusplus
--} /* for C++ V2.0 */
--#endif
--
-+_XFUNCPROTOEND
- 
- /* backward compatibility */
- 



Reply to: