Date: Sat, 04 Nov 2000 09:33:01 +1100 (EST) From: peter.jeremy@alcatel.com.au To: FreeBSD-gnats-submit@FreeBSD.ORG Subject: ports/22590: xpaint writes pixmaps to stdout or stderr Message-ID: <00Nov4.103230est.115201@border.alcanet.com.au>
next in thread | raw e-mail | index | archive | help
>Number: 22590 >Category: ports >Synopsis: graphics/xpaint writes pixmaps to stdout or stderr >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Nov 03 14:40:00 PST 2000 >Closed-Date: >Last-Modified: >Originator: Peter Jeremy >Release: FreeBSD 5.0-CURRENT i386 >Organization: Alcatel Australia Limited >Environment: cvs-cur 6827 xpaint-2.5.7 >Description: When xpaint starts, it writes pixmap images to the tty (though I'm not sure if it's stdout or stderr). >How-To-Repeat: Start xpaint >Fix: Replace patch-ae with the following. The original patch-ae has the following bugs (both in the code replacing mktemp() with mkstemp()): 1) openTemp() can return NULL if the mkstemp() fails, or if the fdopen() fails. In the former case, the tempName stack is unaltered, in the latter, the new name has been pushed onto the tempName stack. This means the caller can't determine whether removeTemp() should be called or not. The original code always has the latter behaviour. 2) The name pushed onto the tempName stack (and optionally returned) is ${TMPDIR:-/tmp}, rather than the temporary filename. I'm not sure how these bugs cause xpaint to write the pixmaps to stdout, but suspect it may be inadequate error checking elsewhere. --- readRC.c.orig Tue Jun 25 18:50:39 1996 +++ readRC.c Fri Nov 3 21:51:02 2000 @@ -30,11 +30,13 @@ #include <unistd.h> #endif +#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) #ifdef __STDC__ extern char *mktemp(char *); #else extern char *mktemp(); #endif /* __STDC__ */ +#endif #define RC_FILENAME ".XPaintrc" @@ -64,6 +66,9 @@ static FILE * openTemp(char **np) { +#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) + int fd; +#endif char *n; char xx[256]; @@ -72,11 +77,19 @@ strcpy(xx, n); strcat(xx, "/XPaintXXXXXXX"); +#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) + fd = mkstemp(xx); + tempName[++tempIndex] = XtNewString(xx); + if (np != NULL) + *np = tempName[tempIndex]; + return (fd < 0) ? (FILE *)NULL : fdopen(fd, "w"); +#else n = mktemp(xx); tempName[++tempIndex] = XtNewString(n); if (np != NULL) *np = tempName[tempIndex]; return fopen(tempName[tempIndex], "w"); +#endif } static void >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?00Nov4.103230est.115201>