[PATCH] Fix to fdisk command

Juan Perez-Sanchez <[email protected]>
Newsgroups gmane.linux.ports.x8086
Message-ID <CAD6VGubt-SBCwHEhvnWiJyvf1pXEicAa4WH0WDiLbbKMDSEqEQ@mail.gmail.com>
Hi,

   Disk partitions created with ELKS fdisk are not recognized by the
ELKS kernel because they lack a signature. This patch fixes the problem.

Greetings,

Juan
elksfdisk.patch (text/x-patch, 694 B)
diff -Nur elkscmd.orig/disk_utils/fdisk.c elkscmd/disk_utils/fdisk.c
--- elkscmd.orig/disk_utils/fdisk.c	2014-11-27 10:53:27.000000000 -0600
+++ elkscmd/disk_utils/fdisk.c	2014-12-07 22:49:38.609092220 -0600
@@ -314,12 +314,15 @@
 
     if (lseek(pFd,0L,SEEK_SET)!=0)
 	printf("ERROR!  Cannot seek to offset 0.\n");
-    else
+    else {
+        partitiontable[510] = 0x55;
+        partitiontable[511] = 0xAA;
 	if ((i=write(pFd,partitiontable,512))!=512) {
 	    printf("ERROR!  Only wrote %d of 512 bytes to the partition table.\n",i);
 	    printf("        Table possibly corrupted.\n");
 	} else
 	    printf("Successfully wrote %d bytes to %s\n",i,dev);
+    }
     fflush(stdout);
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.