diff options
author | hpa <hpa> | 2002-02-18 23:43:43 +0000 |
---|---|---|
committer | hpa <hpa> | 2002-02-18 23:43:43 +0000 |
commit | 4bf7873b3b5e7cce19fe3aa52ad7476658efa885 (patch) | |
tree | f41d6290f28c39edfed60fa93f1ee72ac23d886e | |
parent | b0fd00bbef2eb6b08857e1dcc52341f29b073c88 (diff) | |
download | syslinux-1.6x-merge-2.tar.gz |
Actually make the -o option work properly.syslinux-1.6x-merge-2
-rw-r--r-- | syslinux.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -101,7 +101,7 @@ static u_int32_t get_32(unsigned char *p) void usage(void) { - fprintf(stderr, "Usage: %s [-sf] device\n", program); + fprintf(stderr, "Usage: %s [-sf] [-o offset] device\n", program); exit(1); } @@ -139,7 +139,7 @@ int main(int argc, char *argv[]) } else if ( *opt == 'f' ) { force = 1; /* Force install */ } else if ( *opt == 'o' && argp[1] ) { - offset = atol(*++argp); /* Byte offset */ + offset = strtoul(*++argp, NULL, 0); /* Byte offset */ } else { usage(); } @@ -421,6 +421,13 @@ umount: exit(1); } + if ( lseek(dev_fd, offset, SEEK_SET) != offset ) { + if ( !(force && errno == EBADF) ) { + fprintf(stderr, "%s: seek error", device); + exit(1); + } + } + /* Copy the old superblock into the new boot sector */ memcpy(bootsect+bsCopyStart, sectbuf+bsCopyStart, bsCopyLen); |