From owner-freebsd-current Mon Jun 24 16:54:22 2002 Delivered-To: freebsd-current@freebsd.org Received: from smtp.noos.fr (camus.noos.net [212.198.2.70]) by hub.freebsd.org (Postfix) with ESMTP id 81F7A37B400 for ; Mon, 24 Jun 2002 16:54:16 -0700 (PDT) Received: (qmail 31801008 invoked by uid 0); 24 Jun 2002 23:54:14 -0000 Received: from unknown (HELO gits.gits.dyndns.org) ([212.198.229.153]) (envelope-sender ) by 212.198.2.70 (qmail-ldap-1.03) with SMTP for ; 24 Jun 2002 23:54:14 -0000 Received: from gits.gits.dyndns.org (0etxrmds4q0yjj8a@localhost [127.0.0.1]) by gits.gits.dyndns.org (8.12.4/8.12.4) with ESMTP id g5ONsDtY001681; Tue, 25 Jun 2002 01:54:13 +0200 (CEST) (envelope-from root@gits.dyndns.org) Received: (from root@localhost) by gits.gits.dyndns.org (8.12.4/8.12.4/Submit) id g5ONs0L4001680; Tue, 25 Jun 2002 01:54:00 +0200 (CEST) (envelope-from root) Date: Tue, 25 Jun 2002 01:54:00 +0200 From: Cyrille Lefevre To: Jonathan Belson Cc: Mark Murray , current@freebsd.org Subject: Re: Perl scripts that need rewiting - Any volunteers? Message-ID: <20020624235400.GB1550@gits.dyndns.org> References: <3D0A464B.7040904@witchspace.com> <200206222154.g5MLsva4041792@grimreaper.grondar.org> <3D17770E.1060904@witchspace.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3D17770E.1060904@witchspace.com> User-Agent: Mutt/1.3.99i Organization: ACME Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, Jun 24, 2002 at 08:46:22PM +0100, Jonathan Belson wrote: > Mark Murray wrote: > >o Please do not use mktemp(); use mkstemp() instead. > > I used mktemp() to get a filename to redirect to, eg. > > /* Improvised example */ > char *cmd; > asprintf(cmd, "prog > %s", mktemp(blah)); > system(cmd); > free(cmd); > > I couldn't see a simple way around this, any clues? int fd = mkstemp (blah); asprintf(cmd, "prog > /dev/fd/%d", fd); I don't look at the code, but how about popen(3) ? Cyrille. -- Cyrille Lefevre mailto:cyrille.lefevre@laposte.net To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message