Subject: Re: pkg_add nuked my system and I'm going nuts
To: David Brownlee <abs@anim.dreamworks.com>
From: Hubert Feyrer <hubert.feyrer@rrzc1.rz.uni-regensburg.de>
List: tech-pkg
Date: 07/08/1998 09:13:37
On Tue, 7 Jul 1998, David Brownlee wrote:
> 	Can we put a check in to call abort() if this happens?
> 
> 	Something of a bandaid - but avoiding this is pretty close to
> 	critical....

OK, i've committed this for a lack of a better solution. 
I was'n able to reproduce this, though. 

*sigh* I wich everyone would update his pkg_* _now_ to prevent this... 


 - Hubert


Index: lib/pen.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/pkg_install/lib/pen.c,v
retrieving revision 1.6
diff -u -r1.6 pen.c
--- pen.c       1998/03/27 12:17:58     1.6
+++ pen.c       1998/07/08 07:04:09
@@ -130,6 +130,10 @@
        cleanup(0);
        errx(2, "can't chdir back to '%s'", Previous);
     } else if (Current[0] && strcmp(Current, Previous)) {
+        if (strcmp(Current,"/")==0) {
+            fprintf(stderr,"PANIC: About to rm -rf / (not doing so, 
aborting)\n");
+            abort();
+        }
        if (vsystem("rm -rf %s", Current))
            warnx("couldn't remove temporary dir '%s'", Current);
        strcpy(Current, Previous);

--
Hubert Feyrer <hubert.feyrer@rz.uni-regensburg.de>