From owner-freebsd-ports Sat Sep 7 10:10:56 2002 Delivered-To: freebsd-ports@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7506437B400 for ; Sat, 7 Sep 2002 10:10:04 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4522643E6E for ; Sat, 7 Sep 2002 10:10:03 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g87HA2JU041687 for ; Sat, 7 Sep 2002 10:10:03 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g87HA2PJ041686; Sat, 7 Sep 2002 10:10:02 -0700 (PDT) Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 75B5D37B400; Sat, 7 Sep 2002 10:06:51 -0700 (PDT) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.208.78.105]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1F8E243E3B; Sat, 7 Sep 2002 10:06:51 -0700 (PDT) (envelope-from kargl@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) by troutmask.apl.washington.edu (8.12.6/8.12.5) with ESMTP id g87H6o4m022066; Sat, 7 Sep 2002 10:06:50 -0700 (PDT) (envelope-from kargl@troutmask.apl.washington.edu) Received: (from kargl@localhost) by troutmask.apl.washington.edu (8.12.6/8.12.6/Submit) id g87H6o2D022065; Sat, 7 Sep 2002 10:06:50 -0700 (PDT) Message-Id: <200209071706.g87H6o2D022065@troutmask.apl.washington.edu> Date: Sat, 7 Sep 2002 10:06:50 -0700 (PDT) From: "Steven G. Kargl" Reply-To: "Steven G. Kargl" To: FreeBSD-gnats-submit@FreeBSD.org Cc: kris@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: ports/42510: Fix build of news/knews on -current Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 42510 >Category: ports >Synopsis: Fix build of news/knews on -current >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Sep 07 10:10:02 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Steven G. Kargl >Release: FreeBSD 5.0-CURRENT i386 >Organization: APL/UW >Environment: System: FreeBSD troutmask.apl.washington.edu 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Wed Sep 4 12:10:46 PDT 2002 kargl@troutmask.apl.washington.edu:/usr/obj/usr/src/sys/TROUTMASK i386 >Description: The news/knews port no longer builds because the visibility of P_tmpdir in /usr/include/stdio.h has been changed. From stdio.h we have /* System V/ANSI C; this is the wrong way to do this, do *not* use these. */ #if __XSI_VISIBLE #define P_tmpdir "/var/tmp/" #endif >How-To-Repeat: cd /usr/ports/news/knews make >Fix: Replace knews/files/patch-file.c with the following patch. --- src/file.c.orig Sat Sep 7 09:12:38 2002 +++ src/file.c Sat Sep 7 09:53:48 2002 @@ -185,16 +185,20 @@ int create_temp_fd(char **name) { int fd; - - *name = tmpnam(NULL); - if (!*name) - fd = -1; - else { - unlink(*name); - fd = open(*name, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR); - if (fd < 0) - *name = NULL; - } + char filename[FILENAME_MAX]; + + if (getenv("TMPDIR") != NULL) { + strlcpy(filename, getenv("TMPDIR"), FILENAME_MAX); + strlcat(filename, "/tmp.XXXXXX", FILENAME_MAX); + } else if (access("/var/tmp", (R_OK|W_OK)) == 0) + strlcpy(filename, "/var/tmp/tmp.XXXXXX", FILENAME_MAX); + else + strlcpy(filename, "tmp.XXXXXX", FILENAME_MAX); + + if ((fd = mkstemp(filename)) == -1) + *name = NULL; + else + *name = filename; return fd; } >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message