NetBSD Problem Report #51299

From www@NetBSD.org  Thu Jun 30 08:48:27 2016
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 0A7A97A220
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 30 Jun 2016 08:48:27 +0000 (UTC)
Message-Id: <20160630084826.300517AAB8@mollari.NetBSD.org>
Date: Thu, 30 Jun 2016 08:48:26 +0000 (UTC)
From: dcb314@hotmail.com
Reply-To: dcb314@hotmail.com
To: gnats-bugs@NetBSD.org
Subject: src/usr.bin/utoppya/utoppya.c: 2 * redundant condition ?
X-Send-Pr-Version: www-1.0

>Number:         51299
>Category:       bin
>Synopsis:       src/usr.bin/utoppya/utoppya.c: 2 * redundant condition ?
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jun 30 08:50:00 +0000 2016
>Last-Modified:  Thu Jun 30 15:45:00 +0000 2016
>Originator:     David Binderman
>Release:        cvs dated 20160630
>Organization:
>Environment:
>Description:

src/usr.bin/utoppya/utoppya.c:292]: (style) Redundant condition: If 'EXPR == '\\'', the comparison 'EXPR' is always true.
src/usr.bin/utoppya/utoppya.c:294]: (style) Redundant condition: If 'EXPR == '\\'', the comparison 'EXPR' is always true.

Source code is

    for (o = oldpath; *o && *o == '\\'; o++)
        ;
    for (n = newpath; *n && *n == '\\'; n++)
        ;




>How-To-Repeat:

>Fix:

>Audit-Trail:
From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/51299: src/usr.bin/utoppya/utoppya.c: 2 * redundant
 condition ?
Date: Thu, 30 Jun 2016 15:41:18 +0000

 On Thu, Jun 30, 2016 at 08:50:01AM +0000, dcb314@hotmail.com wrote:
  > src/usr.bin/utoppya/utoppya.c:292]: (style) Redundant condition: If 'EXPR == '\\'', the comparison 'EXPR' is always true.
  > src/usr.bin/utoppya/utoppya.c:294]: (style) Redundant condition: If 'EXPR == '\\'', the comparison 'EXPR' is always true.
  > 
  > Source code is
  > 
  >     for (o = oldpath; *o && *o == '\\'; o++)
  >         ;
  >     for (n = newpath; *n && *n == '\\'; n++)
  >         ;

 Furthermore, the two previous loops in the same function have just
 removed all '\\' characters from both strings.

 The code following interchangeably uses o/n and oldpath/newpath in a
 way that makes me think it'll all break if these loops are changed to
 use '/' as the prior loops might make one think, so I'm guessing this
 pair of loops should just be removed.

 Anyone know anything about native pathnames on the utoppy hw?

 -- 
 David A. Holland
 dholland@netbsd.org

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.