From owner-freebsd-bugs Fri May 9 01:10:03 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id BAA19811 for bugs-outgoing; Fri, 9 May 1997 01:10:03 -0700 (PDT) Received: (from gnats@localhost) by hub.freebsd.org (8.8.5/8.8.5) id BAA19799; Fri, 9 May 1997 01:10:02 -0700 (PDT) Resent-Date: Fri, 9 May 1997 01:10:02 -0700 (PDT) Resent-Message-Id: <199705090810.BAA19799@hub.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@FreeBSD.ORG, lbnstn@lili.uni-bielefeld.de Received: from lili23.lili.uni-bielefeld.de (lili23.lili.uni-bielefeld.de [129.70.23.23]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id BAA19330 for ; Fri, 9 May 1997 01:00:09 -0700 (PDT) Received: (from lbnstn@localhost) by lili23.lili.uni-bielefeld.de (8.8.5/8.8.5) id KAA00378; Fri, 9 May 1997 10:00:07 +0200 (CEST) Message-Id: <199705090800.KAA00378@lili23.lili.uni-bielefeld.de> Date: Fri, 9 May 1997 10:00:07 +0200 (CEST) From: lbnstn@lili.uni-bielefeld.de Reply-To: lbnstn@lili.uni-bielefeld.de To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: bin/3556: Bug with -i option in /usr/bin/lpr Sender: owner-bugs@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >Number: 3556 >Category: bin >Synopsis: Bug with -i option in /usr/bin/lpr >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri May 9 01:10:01 PDT 1997 >Last-Modified: >Originator: Uwe Laubenstein >Organization: Universitaet Bielefeld, Germany >Release: FreeBSD 2.2.1-RELEASE i386 >Environment: >Description: There seems to be a bug in /usr/bin/lpr: If lpr is invoked with -i but no argument to -i is supplied, then then getopt eats up the argument following -i. The bug is present in "FreeBSD 2.2-970422-RELENG" and "FreeBSD 2.2.1-RELEASE" >How-To-Repeat: lpr -i /etc/motd # hangs lpr -i -p /etc/motd # ignores -p >Fix: *** /usr/src/usr.sbin/lpr/lpr/lpr.c.orig Wed Feb 26 03:31:53 1997 --- /usr/src/usr.sbin/lpr/lpr/lpr.c Thu May 8 12:08:12 1997 *************** *** 74,79 **** --- 74,81 ---- #include "lp.local.h" #include "pathnames.h" + extern int optreset; + static char *cfname; /* daemon control files, linked from tf's */ static char *class = host; /* class title on header page */ static char *dfname; /* data files */ *************** *** 121,127 **** struct passwd *pw; struct group *gptr; register char *arg, *cp; ! char buf[BUFSIZ]; int c, i, f, errs; struct stat stb; --- 123,129 ---- struct passwd *pw; struct group *gptr; register char *arg, *cp; ! char *p, buf[BUFSIZ]; int c, i, f, errs; struct stat stb; *************** *** 198,204 **** case 'i': /* indent output */ iflag++; ! indent = atoi(optarg); break; case 'm': /* send mail when done */ --- 200,214 ---- case 'i': /* indent output */ iflag++; ! indent = strtol (optarg, &p, 10); ! /* if optarg is not a valid number we assume */ ! /* it is another option or a filename */ ! if (*p != '\0') ! { ! indent = 8; ! optreset = 1; ! optind--; ! } break; case 'm': /* send mail when done */ >Audit-Trail: >Unformatted: