From owner-freebsd-hackers@FreeBSD.ORG Mon Nov 9 07:10:09 2009 Return-Path: Delivered-To: freebsd-hackers@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C93A41065672 for ; Mon, 9 Nov 2009 07:10:09 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from poseidon.ceid.upatras.gr (poseidon.ceid.upatras.gr [150.140.141.169]) by mx1.freebsd.org (Postfix) with ESMTP id 3F3988FC14 for ; Mon, 9 Nov 2009 07:10:09 +0000 (UTC) Received: from mail.ceid.upatras.gr (unknown [10.1.0.143]) by poseidon.ceid.upatras.gr (Postfix) with ESMTP id 5430BEB484E; Mon, 9 Nov 2009 09:10:08 +0200 (EET) Received: from localhost (europa.ceid.upatras.gr [127.0.0.1]) by mail.ceid.upatras.gr (Postfix) with ESMTP id 43ECC452F7; Mon, 9 Nov 2009 09:10:08 +0200 (EET) X-Virus-Scanned: amavisd-new at ceid.upatras.gr Received: from mail.ceid.upatras.gr ([127.0.0.1]) by localhost (europa.ceid.upatras.gr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uvEAARemxKot; Mon, 9 Nov 2009 09:10:08 +0200 (EET) Received: from kobe.laptop (adsl317-61.kln.forthnet.gr [188.4.41.61]) by mail.ceid.upatras.gr (Postfix) with ESMTP id E7648452F5; Mon, 9 Nov 2009 09:10:07 +0200 (EET) Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.3/8.14.3) with ESMTP id nA97A7IE016171 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 9 Nov 2009 09:10:07 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by kobe.laptop (8.14.3/8.14.3/Submit) id nA97A6E4016170; Mon, 9 Nov 2009 09:10:06 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) From: Giorgos Keramidas To: Alexander Best References: Date: Mon, 09 Nov 2009 09:10:06 +0200 In-Reply-To: (Alexander Best's message of "Mon, 09 Nov 2009 01:47:40 +0100 (CET)") Message-ID: <873a4o2my9.fsf@kobe.laptop> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Cc: freebsd-hackers@FreeBSD.org Subject: Re: [patch] burncd: honour for envar SPEED X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Nov 2009 07:10:09 -0000 --=-=-= On Mon, 09 Nov 2009 01:47:40 +0100 (CET), Alexander Best wrote: > any thoughts on these small changes to burncd? > > Index: usr.sbin/burncd/burncd.c > =================================================================== > --- usr.sbin/burncd/burncd.c (revision 199064) > +++ usr.sbin/burncd/burncd.c (working copy) > @@ -78,13 +78,16 @@ > { > int arg, addr, ch, fd; > int dao = 0, eject = 0, fixate = 0, list = 0, multi = 0, preemp = 0; > - int nogap = 0, speed = 4 * 177, test_write = 0, force = 0; > + int nogap = 0, speed = 0, test_write = 0, force = 0; > int block_size = 0, block_type = 0, cdopen = 0, dvdrw = 0; > const char *dev; > > if ((dev = getenv("CDROM")) == NULL) > dev = "/dev/acd0"; > > + if ((speed = getenv("SPEED")) == NULL) > + speed = 4 * 177; > + > while ((ch = getopt(argc, argv, "def:Flmnpqs:tv")) != -1) { > switch (ch) { > case 'd': Hi Alexander, The idea seems very good, but since the value of SPEED is user supplied data, I would rather see a bit of validation code after getenv(). With this version of the patch, burncd would happily accept and try to use values that are quite absurd, i.e.: env SPEED=12234567890 burncd ... It may also be sensible to do the translation from "human readable" speed values and the multiplication with 177 _after_ the value has been parsed from getenv(), so that e.g. one can write: env SPEED=4 burncd and get behavior similar to the current default. --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.11 (FreeBSD) iEYEARECAAYFAkr3wE4ACgkQ1g+UGjGGA7YjFgCfXgfRdV1pVOnfH/AMcQy3HmLw Bx8An2bcrDqoGuT+yA6SFkYkDr9qxrSJ =sORN -----END PGP SIGNATURE----- --=-=-=--