From 6d24a5fb5c7e2343e0f9ca9f1e720b53549691fe Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Tue, 12 Aug 2008 09:15:00 +0000 Subject: [PATCH] map_read_sector() uses offset from the beginning of the partition, not of the disk --- tools/emile-map-set.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/emile-map-set.c b/tools/emile-map-set.c index 63228ce..ded124d 100644 --- a/tools/emile-map-set.c +++ b/tools/emile-map-set.c @@ -168,7 +168,7 @@ static int get_driver(map_t *map, int partition, char* appledriver) return -1; } - ret = map_read_sector(map, block * block_size, (char*)code, bootsize); + ret = map_read_sector(map, 0, (char*)code, partition_size * 512); if (ret == -1) { fprintf(stderr, "ERROR: cannot read driver (read())\n"); @@ -273,8 +273,7 @@ static int put_driver(map_t *map, int partition, char* appledriver) /* write file in partition */ - ret = map_write_sector(map, block * block_size, (char*)code, - st.st_size); + ret = map_write_sector(map, 0, (char*)code, st.st_size); free(code); if (ret == -1) @@ -436,12 +435,12 @@ int main(int argc, char** argv) ret = emile_scsi_get_rdev(dev_name, &driver, &disk, &partition); else ret = emile_scsi_get_rdev(dev_name, &driver, &disk, NULL); - if ( (ret == -1) && (optind < argc)) + + if (ret == -1) { disk_name = dev_name; driver = 0; disk = 0; - partition = atoi(argv[optind++]); } else if (ret == -1) {