From hbarker@dsms.com  Thu Jun 11 16:15:04 1998
Received: from ns.dsms.com (dsms.jsnet.com [207.82.57.142])
          by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id QAA25682
          for <FreeBSD-gnats-submit@freebsd.org>; Thu, 11 Jun 1998 16:15:04 -0700 (PDT)
          (envelope-from hbarker@dsms.com)
Received: from fs.sm.dsms.com (hbarker@fs.sm.dsms.com [199.89.215.10])
          by ns.dsms.com (8.8.5/8.8.4) with ESMTP
	  id QAA20455 for <FreeBSD-gnats-submit@freebsd.org>; Thu, 11 Jun 1998 16:15:03 -0700 (PDT)
Received: (from hbarker@localhost)
          by fs.sm.dsms.com (8.8.8/8.8.4sm1)
	  id QAA24843; Thu, 11 Jun 1998 16:15:02 -0700 (PDT)
Message-Id: <199806112315.QAA24843@fs.sm.dsms.com>
Date: Thu, 11 Jun 1998 16:15:02 -0700 (PDT)
From: harold barker Hbarker <hbarker@dsms.com>
Reply-To: hbarker@dsms.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: can not run multiple instances of /sbin/restore because temp files are not unique
X-Send-Pr-Version: 3.2

>Number:         6919
>Category:       bin
>Synopsis:       can not run multiple instances of /sbin/restore because temp files are not unique
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jun 11 16:20:01 PDT 1998
>Closed-Date:    Fri May 21 16:16:35 PDT 1999
>Last-Modified:  Fri May 21 16:17:37 PDT 1999
>Originator:     harold barker &
>Release:        FreeBSD 2.2.6-STABLE i386
>Organization:
dsms
>Environment:

	FreeBSD build2.jsnet.com 2.2.6-STABLE FreeBSD 2.2.6-STABLE #0: Mon Jun  8 15:26:54 PDT 1998     hbarker@build.jsnet.com:/usr/src/sys/compile/dsms226aCAM  i386


>Description:

/sbin/restore uses two files in /tmp. The names are not unique to each invocation, so it is not possible to run more than one restore at a give time.

>How-To-Repeat:



>Fix:
	
cvs diff: Diffing .
Index: dirs.c
===================================================================
RCS file: /d0a/cvs_root_freebsd/src/sbin/restore/dirs.c,v
retrieving revision 1.6.2.1
diff -r1.6.2.1 dirs.c
146c146,147
< 
---
>     pid_t pid;
> 
148c149,151
<       (void) sprintf(dirfile, "%srstdir%d", _PATH_TMP, dumpdate);
---
>       pid = getpid();
> 
>       (void) sprintf(dirfile, "%srstdir-%d-%d", _PATH_TMP, pid, dumpdate);
164c167
<               (void) sprintf(modefile, "%srstmode%d", _PATH_TMP, dumpdate);
---
>               (void) sprintf(modefile, "%srstmode-%d-%d", _PATH_TMP, pid, dumpdate);


>Release-Note:
>Audit-Trail:

From: njs3@doc.ic.ac.uk (Niall Smart)
To: hbarker@dsms.com, FreeBSD-gnats-submit@freebsd.org
Cc:  Subject: Re: bin/6919: can not run multiple instances of /sbin/restore because temp files are not unique
Date: Fri, 12 Jun 1998 10:16:06 +0100

 On Jun 11,  4:15pm, harold barker Hbarker wrote:
 } Subject: bin/6919: can not run multiple instances of /sbin/restore because
 > 
 > >Description:
 > 
 > /sbin/restore uses two files in /tmp. The names are not unique to each invocation, so it is not possible to run more than one restore at a give time.
 > 
 > >How-To-Repeat:
 > 
 > <       (void) sprintf(dirfile, "%srstdir%d", _PATH_TMP, dumpdate);
 > ---
 > >       pid = getpid();
 > > 
 > >       (void) sprintf(dirfile, "%srstdir-%d-%d", _PATH_TMP, pid, dumpdate);
 > 164c167
 > <               (void) sprintf(modefile, "%srstmode%d", _PATH_TMP, dumpdate);
 > ---
 > >               (void) sprintf(modefile, "%srstmode-%d-%d", _PATH_TMP, pid, dumpdate);
 
 Won't a call to mkstemp work here?
 
 Niall
State-Changed-From-To: open->closed 
State-Changed-By: jmz 
State-Changed-When: Fri May 21 16:16:35 PDT 1999 
State-Changed-Why:  
Fixed in rev. 1.7 of dirs.c 
>Unformatted:
