Lines 28-33
Link Here
|
28 |
|
28 |
|
29 |
#include <sys/param.h> |
29 |
#include <sys/param.h> |
30 |
#include <sys/stat.h> |
30 |
#include <sys/stat.h> |
|
|
31 |
#include <sys/mman.h> |
31 |
#include <errno.h> |
32 |
#include <errno.h> |
32 |
#include <libutil.h> |
33 |
#include <libutil.h> |
33 |
#include <inttypes.h> |
34 |
#include <inttypes.h> |
Lines 380-386
Link Here
|
380 |
struct gctl_req *r; |
381 |
struct gctl_req *r; |
381 |
const char *errstr, *scheme; |
382 |
const char *errstr, *scheme; |
382 |
uint8_t *boot; |
383 |
uint8_t *boot; |
383 |
size_t bootsize, bytes; |
384 |
ssize_t bootsize; |
384 |
int bootfd; |
385 |
int bootfd; |
385 |
|
386 |
|
386 |
/* |
387 |
/* |
Lines 406-418
Link Here
|
406 |
} |
407 |
} |
407 |
|
408 |
|
408 |
bootsize = lseek(bootfd, 0, SEEK_END); |
409 |
bootsize = lseek(bootfd, 0, SEEK_END); |
409 |
boot = malloc(bootsize); |
410 |
if (bootsize == -1) { |
410 |
lseek(bootfd, 0, SEEK_SET); |
411 |
dialog_msgbox("Bootcode Error", strerror(errno), 0, 0, |
411 |
bytes = 0; |
412 |
TRUE); |
412 |
while (bytes < bootsize) |
413 |
return; |
413 |
bytes += read(bootfd, boot + bytes, bootsize - bytes); |
414 |
} |
414 |
close(bootfd); |
|
|
415 |
|
415 |
|
|
|
416 |
boot = mmap(0, bootsize, PROT_READ, 0, bootfd, 0); |
417 |
if (boot == MAP_FAILED) { |
418 |
dialog_msgbox("Bootcode Error", strerror(errno), 0, 0, |
419 |
TRUE); |
420 |
return; |
421 |
} |
422 |
|
416 |
r = gctl_get_handle(); |
423 |
r = gctl_get_handle(); |
417 |
gctl_ro_param(r, "class", -1, "PART"); |
424 |
gctl_ro_param(r, "class", -1, "PART"); |
418 |
gctl_ro_param(r, "arg0", -1, gp->lg_name); |
425 |
gctl_ro_param(r, "arg0", -1, gp->lg_name); |
Lines 423-429
Link Here
|
423 |
if (errstr != NULL && errstr[0] != '\0') |
430 |
if (errstr != NULL && errstr[0] != '\0') |
424 |
gpart_show_error("Bootcode Error", NULL, errstr); |
431 |
gpart_show_error("Bootcode Error", NULL, errstr); |
425 |
gctl_free(r); |
432 |
gctl_free(r); |
426 |
free(boot); |
433 |
munmap(boot, bootsize); |
|
|
434 |
close(bootfd); |
427 |
} |
435 |
} |
428 |
|
436 |
|
429 |
static void |
437 |
static void |