diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2006-07-09 21:19:42 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2006-07-09 21:19:42 +0000 |
commit | 14185752f275aa406d755fb92355ee37b1311ace (patch) | |
tree | 1e997cbfac8607aa4a89f607356b6f186bdf2e36 /sbin/fdisk/fdisk.c | |
parent | 727028c94d643f7e76bd9a6c0fd93dddebcabe4c (diff) |
Do not try and read /usr/mdec/mbr in ``fdisk -e'' unless the architecture
really provides it.
Diffstat (limited to 'sbin/fdisk/fdisk.c')
-rw-r--r-- | sbin/fdisk/fdisk.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sbin/fdisk/fdisk.c b/sbin/fdisk/fdisk.c index 01e9e41c2da..d2a7f3ce7c6 100644 --- a/sbin/fdisk/fdisk.c +++ b/sbin/fdisk/fdisk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fdisk.c,v 1.40 2005/05/01 20:53:38 jmc Exp $ */ +/* $OpenBSD: fdisk.c,v 1.41 2006/07/09 21:19:41 miod Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -68,7 +68,11 @@ main(int argc, char *argv[]) int c_arg = 0, h_arg = 0, s_arg = 0; disk_t disk; DISK_metrics *usermetrics; +#if defined(__amd64__) || defined(__i386__) || defined (__powerpc__) char *mbrfile = _PATH_MBR; +#else + char *mbrfile = NULL; +#endif mbr_t mbr; char mbr_buf[DEV_BSIZE]; @@ -143,9 +147,12 @@ main(int argc, char *argv[]) exit(USER_print_disk(&disk)); /* Parse mbr template, to pass on later */ - if ((fd = open(mbrfile, O_RDONLY)) == -1) { + if (mbrfile != NULL && (fd = open(mbrfile, O_RDONLY)) == -1) { warn("%s", mbrfile); warnx("using builtin MBR"); + mbrfile == NULL; + } + if (mbrfile == NULL) { memcpy(mbr_buf, builtin_mbr, sizeof(mbr_buf)); } else { MBR_read(fd, 0, mbr_buf); |