From c6d1facb60e32de9db22c8d406a50ef21b0a1a4c Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Sat, 18 Oct 1997 12:07:58 +0000 Subject: do not allow add of existing partition --- sbin/disklabel/editor.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'sbin') 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 @@ -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 @@ -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' */ -- cgit v1.2.3