NetBSD Problem Report #8534

Received: (qmail 20997 invoked from network); 2 Oct 1999 17:52:23 -0000
Message-Id: <199910021754.KAA12839@merlot.eecs.harvard.edu>
Date: Sat, 2 Oct 1999 10:54:52 -0700 (PDT)
From: dholland@eecs.harvard.edu
Reply-To: dholland@eecs.harvard.edu
To: gnats-bugs@gnats.netbsd.org
Subject: Undefined C in ftpd/ftpcmd.y
X-Send-Pr-Version: 3.95

>Number:         8534
>Category:       bin
>Synopsis:       Undefined C in ftpd/ftpcmd.y
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Oct 02 11:05:01 +0000 1999
>Closed-Date:    Mon Oct 04 17:37:46 +0000 1999
>Last-Modified:  Tue Sep 04 23:24:00 +0000 2001
>Originator:     David A. Holland
>Release:        NetBSD-current of 19991002
>Organization:
   - David A. Holland             |    VINO project home page:
     dholland@eecs.harvard.edu    | http://www.eecs.harvard.edu/vino
>Environment:

	This was found elsewhere, but applies to today's -current sources.

>Description:

	ftpcmd.y contains an expression of the form "a = ++a;" which is
	undefined in C.

	The precise offending statement is
		state = state == OSTR ? STR2 : ++state;
	I believe the correct expression is to use "state+1" instead 
	of "++state".

	This was actually caught by Phil Copeland <root@zen.ics.uwe.ac.uk>.

>How-To-Repeat:

	Apparently, compiling ftpd with the DEC alpha compiler causes it
	to warn about the expression in question.

>Fix:

	Patch (not actually tested yet):

--- ftpcmd.y.orig	Sat Oct  2 13:29:42 1999
+++ ftpcmd.y	Sat Oct  2 13:30:53 1999
@@ -1514,11 +1514,11 @@
 	case STR1:
 	case ZSTR1:
 	dostr1:
 		if (cbuf[cpos] == ' ') {
 			cpos++;
-			state = state == OSTR ? STR2 : ++state;
+			state = state == OSTR ? STR2 : state+1;
 			return (SP);
 		}
 		break;

 	case ZSTR2:

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: tron 
State-Changed-When: Mon Oct 4 10:37:46 PDT 1999 
State-Changed-Why:  
Patch applied, thanks. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.