Date: Mon, 19 May 2008 19:26:18 +1200 From: Matthew Luckie <mjl@luckie.org.nz> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/123807: [patch] timed does not run on arm (incorrect getopt usage) Message-ID: <E1JxzlC-000G7f-E0@spandex.luckie.org.nz> Resent-Message-ID: <200805190730.m4J7U7F2091176@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E1JxzlC-000G7f-E0>