From owner-freebsd-current Sun Feb 25 2:53:36 2001 Delivered-To: freebsd-current@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 2D2AF37B401 for ; Sun, 25 Feb 2001 02:53:33 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id VAA04802; Sun, 25 Feb 2001 21:53:17 +1100 Date: Sun, 25 Feb 2001 21:48:33 +1100 (EST) From: Bruce Evans X-Sender: bde@besplex.bde.org To: John Hay Cc: kris@FreeBSD.FreeBSD.ORG, current@FreeBSD.ORG Subject: Re: m4 leaving /tmp/m4* directories In-Reply-To: <200102250958.f1P9wYM48544@zibbi.icomtek.csir.co.za> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sun, 25 Feb 2001, John Hay wrote: > After m4 has been changed to do its temporary work in a subdirectory, > "make world" leaves a lot of /tmp/m4* directories behind. > > This patch fix it for me. It is not protected by a "#ifndef vms" though. > I don't know if vms has rmdir() or not and I'm not sure if we care > about it. I think remove() is supposed to work for all types of files. It is documented to work for directories in FreeBSD. Using remove() in both cases can't break the vms case more than it already is (the previous commit didn't attempt to maintain it). > Index: usr.bin/m4/main.c > =================================================================== > RCS file: /home/ncvs/src/usr.bin/m4/main.c,v > retrieving revision 1.8 > diff -u -r1.8 main.c > --- usr.bin/m4/main.c 2000/11/22 11:09:30 1.8 > +++ usr.bin/m4/main.c 2001/02/20 05:58:02 > @@ -227,9 +227,10 @@ > (void) remove(m4temp); > #else > (void) unlink(m4temp); > - (void) rmdir(m4dir); > #endif > } > + if (m4dir != NULL) > + (void) rmdir(m4dir); > > return 0; > } m4dir is known to be non-NULL here. If it would be NULL, then we have already dumped core for asprintf()'ing it after not checking the value returned by mkdtemp(). We also follow the null pointer after (void)ing errors in asprintf(). Cleaning up is also broken in killdev(). Cleaning up doesn't seem to have ever been implemented in the signal handler. onintr() has the usual bugs, but it doesn't remove any files. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message