Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=fwsetup-ng.git;a=commitdiff;h=61c091b716e8056f2b144bc3b661a398c273d15d

commit 61c091b716e8056f2b144bc3b661a398c273d15d
Author: James Buren <[email protected]>
Date:   Wed Oct 17 15:04:55 2012 -0500

add function for zapping disk label prior to write

diff --git a/src/block.c b/src/block.c
index 1dfd8d3..4fd30fe 100644
--- a/src/block.c
+++ b/src/block.c
@@ -157,6 +157,15 @@ static bool getuuid(struct disk *disk)
}
}

+static bool zapdisk(const char *path)
+{
+  char command[_POSIX_ARG_MAX] = {0};
+
+  snprintf(command,_POSIX_ARG_MAX,"sgdisk --zap-all '%s'",path);
+
+  return execute(command,"/",0);
+}
+
static inline long long alignsector(const struct device *device,long long 
sector)
{
long long alignment = device->alignment;
@@ -819,6 +828,13 @@ extern bool disk_flush(struct disk *disk)
struct partition *prev = 0;
size_t n = 0;

+  if(disk == 0 || (disk->type != DISKTYPE_DOS && disk->type != DISKTYPE_GPT))
+  {
+    errno = EINVAL;
+    fprintf(logfile,"%s: %s\n",__func__,strerror(errno));
+    return false;
+  }
+
if(disk->type == DISKTYPE_DOS)
{
snprintf(command,_POSIX_ARG_MAX,"set -e;echo -n -e '");
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to