git: 9front

Download patch

ref: d1cb26abd3e786f38eb395fd8dc5da6f335ab0ff
parent: df4ef7071ff95d0537ab78d98bc07aacc758588b
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat May 30 18:24:55 EDT 2015

nusb/disk: adding identical partition is a no-op

--- a/sys/src/cmd/nusb/disk/disk.c
+++ b/sys/src/cmd/nusb/disk/disk.c
@@ -75,7 +75,11 @@
 		werrstr("bad partition boundaries");
 		return -1;
 	}
-	if(lookpart(lun, name) != nil) {
+	p = lookpart(lun, name);
+	if(p != nil){
+		/* adding identical partition is no-op */
+		if(p->offset == start && p->length == end - start && p->mode == mode)
+			return 0;
 		werrstr("partition name already in use");
 		return -1;
 	}
--