summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1997-10-18 12:07:58 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1997-10-18 12:07:58 +0000
commitc6d1facb60e32de9db22c8d406a50ef21b0a1a4c (patch)
treeb02715ac50bb7e030b0361238aef00f553a98140 /sbin
parent35d4e28726a47268315c7419564895a3d4855b14 (diff)
do not allow add of existing partition
Diffstat (limited to 'sbin')
-rw-r--r--sbin/disklabel/editor.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c
index 8a4d5f0d8e8..422c70c0806 100644
--- a/sbin/disklabel/editor.c
+++ b/sbin/disklabel/editor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: editor.c,v 1.18 1997/10/17 20:03:46 millert Exp $ */
+/* $OpenBSD: editor.c,v 1.19 1997/10/18 12:07:57 deraadt Exp $ */
/*
* Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -31,7 +31,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: editor.c,v 1.18 1997/10/17 20:03:46 millert Exp $";
+static char rcsid[] = "$OpenBSD: editor.c,v 1.19 1997/10/18 12:07:57 deraadt Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -304,6 +304,12 @@ editor_add(lp, freep, p)
"Partition must be between 'a' and '%c'.\n",
'a' + MAXPARTITIONS - 1);
return;
+ } else if (lp->d_partitions[partno].p_fstype != FS_UNUSED ||
+ lp->d_partitions[partno].p_size != 0) {
+ fprintf(stderr,
+ "Partition '%c' exists. Delete it first.\n",
+ p[0]);
+ return;
}
} else {
/* Find first unused partition that is not 'b' or 'c' */