From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27853 invoked by alias); 21 Sep 2012 18:46:51 -0000 Received: (qmail 27842 invoked by uid 22791); 21 Sep 2012 18:46:50 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 21 Sep 2012 18:46:30 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q8LIkStq002127 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 21 Sep 2012 14:46:28 -0400 Received: from host2.jankratochvil.net (ovpn-113-58.phx2.redhat.com [10.3.113.58]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q8LIkONx004813 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 21 Sep 2012 14:46:27 -0400 Date: Fri, 21 Sep 2012 18:46:00 -0000 From: Jan Kratochvil To: Eli Zaretskii Cc: khooyp@cs.umd.edu, gdb-patches@sourceware.org Subject: Re: [PATCH 1/2]: Refactor relocate_path to also check if the relocated file/directory exists Message-ID: <20120921184623.GA12696@host2.jankratochvil.net> References: <21ACC598-F6B4-4117-BA7B-B316414DE9E3@cs.umd.edu> <20120919130040.GA20442@host2.jankratochvil.net> <20120921182637.GA8747@host2.jankratochvil.net> <83y5k3w7es.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <83y5k3w7es.fsf@gnu.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-09/txt/msg00449.txt.bz2 On Fri, 21 Sep 2012 20:35:39 +0200, Eli Zaretskii wrote: > > Date: Fri, 21 Sep 2012 20:26:37 +0200 > > From: Jan Kratochvil > > Cc: GDB Patches > > > > if (stat (path, &s) != 0 || (isdir && !S_ISDIR (s.st_mode)) > > || (!isdir && S_ISDIR (s.st_mode))) > > a.k.a. > > if (stat (path, &s) != 0 || isdir != S_ISDIR (s.st_mode)) It is not POSIX compliant: The macro evaluates to a non-zero value if the test is true It would have to be written as: if (stat (path, &s) != 0 || !isdir != !S_ISDIR (s.st_mode)) I would find it still OK but this is why I wrote in the mail above: # (I would write it differently but reviews here point to this style.) Because I already posted some such patch here before and it was reviewed by Joel to the form I wrote above. Unfortunately I cannot find the mail now, it is difficult to find a search pattern for this case. Regards, Jan