From owner-freebsd-questions@FreeBSD.ORG Wed May 17 18:21:15 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2580716AEA6 for ; Wed, 17 May 2006 18:21:15 +0000 (UTC) (envelope-from micahjon@ywave.com) Received: from relay0.av-mx.com (relay0.av-mx.com [137.118.16.125]) by mx1.FreeBSD.org (Postfix) with ESMTP id B535443D48 for ; Wed, 17 May 2006 18:21:14 +0000 (GMT) (envelope-from micahjon@ywave.com) X-Virus-Scan-Time: 0 Received: from [137.118.16.55] (HELO mx3.av-mx.com) by relay0.av-mx.com (CommuniGate Pro SMTP 4.2.10) with SMTP id 270238679 for freebsd-questions@freebsd.org; Wed, 17 May 2006 14:21:11 -0400 Received: (qmail 30121 invoked from network); 17 May 2006 18:21:11 -0000 Received: from dsl19095.ywave.com (HELO ?192.168.1.65?) (micahjon@ywave.com@216.227.106.95) by mx3.av-mx.com with SMTP; 17 May 2006 18:21:11 -0000 X-CLIENT-IP: 216.227.106.95 X-CLIENT-HOST: dsl19095.ywave.com Message-ID: <446B6995.1030602@ywave.com> Date: Wed, 17 May 2006 11:21:09 -0700 From: Micah User-Agent: Thunderbird 1.5.0.2 (X11/20060428) MIME-Version: 1.0 To: Andy Greenwood References: <3ee9ca710605171109i57ae4064x702216a1619d6c41@mail.gmail.com> In-Reply-To: <3ee9ca710605171109i57ae4064x702216a1619d6c41@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: FreeBSD Questions Subject: Re: C coding question X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 May 2006 18:21:15 -0000 Andy Greenwood wrote: > I am helping someone work on porting some code to Freebsd, and the > code below works on Linux, but not on FreeBSD (compiles, but gives > Segmentation Fault: 11). I'm not sure where the problem is, and any > pointers would be much appreciated. That's funny, it doesn't even compile on my freebsd: trisha% cat test.c /* Check if we must stop */ if(tf_stat_file != NULL) { tf_stat = fopen(tf_stat_file, "r"); if (tf_stat != NULL) { /* Get state */ stat_state=fgetc(tf_stat); /* Torrentflux asked to shutdown the torrent */ if (stat_state == '0') { mustDie = 1; } } fclose(tf_stat); } trisha% cc test.c test.c:2: error: syntax error before "if" IOW, if you expect usable help please supply some context. Later, Micah