From owner-freebsd-questions@FreeBSD.ORG Wed May 17 18:09:19 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 D35CA16AB6D for ; Wed, 17 May 2006 18:09:19 +0000 (UTC) (envelope-from greenwood.andy@gmail.com) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.174]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5BCDF43D48 for ; Wed, 17 May 2006 18:09:18 +0000 (GMT) (envelope-from greenwood.andy@gmail.com) Received: by ug-out-1314.google.com with SMTP id m3so285195uge for ; Wed, 17 May 2006 11:09:17 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=Z7y2F+VjHv+yYX4d+wbzGxM7pJT1N7gzlzQreVkPdsvA/rVNZzD6mclKa2SPqcg9LLTKRIU5A4zQJBO2MiRdZy7NotwUhgyma7ln3gVFLOBwVqaJlSwJeKJ9oilzb3dGP9m1wLplTiU/HPTi/N9bIWBPmL7i7Glng6aT0kEuPvI= Received: by 10.67.89.6 with SMTP id r6mr833607ugl; Wed, 17 May 2006 11:09:17 -0700 (PDT) Received: by 10.66.251.9 with HTTP; Wed, 17 May 2006 11:09:16 -0700 (PDT) Message-ID: <3ee9ca710605171109i57ae4064x702216a1619d6c41@mail.gmail.com> Date: Wed, 17 May 2006 14:09:16 -0400 From: "Andy Greenwood" To: "FreeBSD Questions" MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Subject: 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:09:21 -0000 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. /* Check if we must stop */ if(tf_stat_file !=3D NULL) { tf_stat =3D fopen(tf_stat_file, "r"); if (tf_stat !=3D NULL) { /* Get state */ stat_state=3Dfgetc(tf_stat); /* Torrentflux asked to shutdown the torrent */ if (stat_state =3D=3D '0') { mustDie =3D 1; } } fclose(tf_stat); }