From owner-freebsd-ports-bugs@FreeBSD.ORG Sat Sep 11 15:30:33 2004 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EB56116A4CE for ; Sat, 11 Sep 2004 15:30:33 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id DB02843D4C for ; Sat, 11 Sep 2004 15:30:33 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i8BFUX6s003526 for ; Sat, 11 Sep 2004 15:30:33 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id i8BFUXdd003516; Sat, 11 Sep 2004 15:30:33 GMT (envelope-from gnats) Date: Sat, 11 Sep 2004 15:30:33 GMT Message-Id: <200409111530.i8BFUXdd003516@freefall.freebsd.org> To: freebsd-ports-bugs@FreeBSD.org From: Simon Barner Subject: Re: ports/71591: audio/funktrackergold segfaults X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Simon Barner List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2004 15:30:34 -0000 The following reply was made to PR ports/71591; it has been noted by GNATS. From: Simon Barner To: "Shawn K. Quinn" Cc: FreeBSD-gnats-submit@FreeBSD.org, markp@FreeBSD.org Subject: Re: ports/71591: audio/funktrackergold segfaults Date: Sat, 11 Sep 2004 17:29:05 +0200 [ Maintainer Cc:ed ] The reason for this is that getenv ("OSTYPE") returns NULL. The following patch works around the problem (IMHO, OS detection at build time is fine when a program build from the FreeBSD ports collection) ----- snip ----- --- funkgold_misc.c.orig Sun Jun 21 08:26:46 1998 +++ funkgold_misc.c Sat Sep 11 17:17:44 2004 @@ -30,22 +29,7 @@ void get_environment(void) { - char *os_type = getenv("OSTYPE"); - register int x; - char *os_tt[] = { - "Linux", - "FreeBSD" - }; - - for(x = 0;x < SO_TT_SIZE;x++) - if(strcmp(os_tt[x],os_type) == 0) - break; - switch(x) - { - case 0: funk_info.funk_cpu_type = FKCPU_LINUX; break; - case 1: funk_info.funk_cpu_type = FKCPU_FREEBSD; break; - default: funk_info.funk_cpu_type = FKCPU_UNKNOWN; break; - } + funk_info.funk_cpu_type = FKCPU_FREEBSD; } /*************************************************************************** ----- snip ----- The more interesting point is why the following little C program fails (please forgive me if I am overlooking something really stupid ;-) (please note that this works fine for other environment variables like HOME, PAGER, ...) int main (int argc, char* argv[]) { char *os = (char*)getenv ("OSTYPE"); printf ("%s\n", os); return 0; }