From owner-p4-projects@FreeBSD.ORG Wed Dec 19 03:17:22 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id F134D16A468; Wed, 19 Dec 2007 03:17:21 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7EE6716A420 for ; Wed, 19 Dec 2007 03:17:21 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 80E4E13C448 for ; Wed, 19 Dec 2007 03:17:21 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id lBJ3HLef006628 for ; Wed, 19 Dec 2007 03:17:21 GMT (envelope-from jb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id lBJ3HLYT006625 for perforce@freebsd.org; Wed, 19 Dec 2007 03:17:21 GMT (envelope-from jb@freebsd.org) Date: Wed, 19 Dec 2007 03:17:21 GMT Message-Id: <200712190317.lBJ3HLYT006625@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jb@freebsd.org using -f From: John Birrell To: Perforce Change Reviews Cc: Subject: PERFORCE change 131204 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2007 03:17:22 -0000 http://perforce.freebsd.org/chv.cgi?CH=131204 Change 131204 by jb@jb_freebsd1 on 2007/12/19 03:17:12 getopt(3) returns an integer. Even on Solaris. The use of EOF is inappropriate. getopt(3) returns nothing associated with a stream file. On FreeBSD/arm, char is unsigned, so using the wrong variable type cases a valid compiler warning. This is a good example of why all code should compile cleanly. Affected files ... .. //depot/projects/dtrace/src/contrib/opensolaris/cmd/dtrace/dtrace.c#11 edit Differences ... ==== //depot/projects/dtrace/src/contrib/opensolaris/cmd/dtrace/dtrace.c#11 (text) ==== @@ -1202,8 +1202,8 @@ g_ofp = stdout; int done = 0, mode = 0; - int err, i; - char c, *p, **v; + int err, i, c; + char *p, **v; struct ps_prochandle *P; pid_t pid; @@ -1230,7 +1230,7 @@ * options into g_argv[], and abort if any invalid options are found. */ for (optind = 1; optind < argc; optind++) { - while ((c = getopt(argc, argv, DTRACE_OPTSTR)) != EOF) { + while ((c = getopt(argc, argv, DTRACE_OPTSTR)) != -1) { switch (c) { case '3': if (strcmp(optarg, "2") != 0) { @@ -1413,7 +1413,7 @@ * this time; these will compiled as part of the fourth processing pass. */ for (optind = 1; optind < argc; optind++) { - while ((c = getopt(argc, argv, DTRACE_OPTSTR)) != EOF) { + while ((c = getopt(argc, argv, DTRACE_OPTSTR)) != -1) { switch (c) { case 'a': if (dtrace_setopt(g_dtp, "grabanon", 0) != 0) @@ -1570,7 +1570,7 @@ * may been affected by any library options set by the second pass. */ for (optind = 1; optind < argc; optind++) { - while ((c = getopt(argc, argv, DTRACE_OPTSTR)) != EOF) { + while ((c = getopt(argc, argv, DTRACE_OPTSTR)) != -1) { switch (c) { case 'c': if ((v = make_argv(optarg)) == NULL)