From owner-freebsd-bugs@FreeBSD.ORG Mon May 19 07:30:07 2008 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F2602106568F for ; Mon, 19 May 2008 07:30:07 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id C828B8FC28 for ; Mon, 19 May 2008 07:30:07 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m4J7U7w6091179 for ; Mon, 19 May 2008 07:30:07 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m4J7U7F2091176; Mon, 19 May 2008 07:30:07 GMT (envelope-from gnats) Resent-Date: Mon, 19 May 2008 07:30:07 GMT Resent-Message-Id: <200805190730.m4J7U7F2091176@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Matthew Luckie Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0DAA11065670 for ; Mon, 19 May 2008 07:26:22 +0000 (UTC) (envelope-from mjl@luckie.org.nz) Received: from mailfilter13.ihug.co.nz (mailfilter13.ihug.co.nz [203.109.136.13]) by mx1.freebsd.org (Postfix) with ESMTP id A93CD8FC2C for ; Mon, 19 May 2008 07:26:20 +0000 (UTC) (envelope-from mjl@luckie.org.nz) Received: from 118-93-121-155.dsl.dyn.ihug.co.nz (HELO spandex.luckie.org.nz) ([118.93.121.155]) by smtp.mailfilter5.ihug.co.nz with ESMTP/TLS/DHE-RSA-AES256-SHA; 19 May 2008 19:26:18 +1200 Received: from mjl by spandex.luckie.org.nz with local (Exim 4.69 (FreeBSD)) (envelope-from ) id 1JxzlC-000G7f-E0 for FreeBSD-gnats-submit@freebsd.org; Mon, 19 May 2008 19:26:18 +1200 Message-Id: Date: Mon, 19 May 2008 19:26:18 +1200 From: Matthew Luckie To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: bin/123807: [patch] timed does not run on arm (incorrect getopt usage) X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Matthew Luckie List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 May 2008 07:30:08 -0000 >Number: 123807 >Category: bin >Synopsis: [patch] timed does not run on arm (incorrect getopt usage) >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon May 19 07:30:07 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Matthew Luckie >Release: FreeBSD 7.0-RELEASE-p1 arm >Organization: >Environment: System: FreeBSD vinyl.luckie.org.nz 7.0-RELEASE-p1 FreeBSD 7.0-RELEASE-p1 #4: Sun May 18 08:49:48 NZST 2008 root@rayon.luckie.org.nz:/usr/obj/arm/usr/src/sys/vinyl arm >Description: getopt returns an integer, -1 when there is no further options to parse. char on arm is an unsigned byte value, so it cannot hold -1. therefore the getopt hack to hold the return value in a char and loop on that will fail and leave the application in an infinite loop >How-To-Repeat: run timed on systems where char is unsigned. >Fix: --- patch-timed.c begins here --- --- usr.sbin/timed/timed/timed.c.orig 2003-07-06 22:37:00.000000000 +1200 +++ usr.sbin/timed/timed/timed.c 2008-05-19 19:14:26.000000000 +1200 @@ -134,7 +134,7 @@ main(argc, argv) struct nets *nt; struct sockaddr_in server; u_short port; - char c; + int c; #ifdef lint ntip = NULL; @@ -147,7 +147,7 @@ main(argc, argv) opterr = 0; while ((c = getopt(argc, argv, "Mtdn:i:F:G:P:")) != -1) { - switch (c) { + switch ((char)c) { case 'M': Mflag = 1; break; --- patch-timed.c ends here --- >Release-Note: >Audit-Trail: >Unformatted: