diff options
Diffstat (limited to 'commands/loadb.c')
-rw-r--r-- | commands/loadb.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/commands/loadb.c b/commands/loadb.c index 8c3906ca42..37c272f6c7 100644 --- a/commands/loadb.c +++ b/commands/loadb.c @@ -33,6 +33,7 @@ #include <command.h> #include <console.h> #include <errno.h> +#include <libfile.h> #include <environment.h> #include <cache.h> #include <getopt.h> @@ -661,21 +662,11 @@ static int do_load_serial_bin(int argc, char *argv[]) output_file = DEF_FILE; /* File should exist */ - ofd = open(output_file, O_WRONLY | O_CREAT); + ofd = open_and_lseek(output_file, O_WRONLY | O_CREAT, offset); if (ofd < 0) { perror(argv[0]); return 3; } - /* Seek to the right offset */ - if (offset) { - int seek = lseek(ofd, offset, SEEK_SET); - if (seek != offset) { - close(ofd); - ofd = 0; - perror(argv[0]); - return 4; - } - } printf("## Ready for binary (kermit) download " "to 0x%08lX offset on %s device at %d bps...\n", offset, |