diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2011-12-25 19:13:52 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2011-12-25 19:13:52 +0000 |
commit | 081eca43c58daf6ae1e54b5d4d76e0e2a753a262 (patch) | |
tree | 5d77c748e2e450b9e24bbe0db0042481431f9557 /sbin/fdisk/fdisk.c | |
parent | c6323e3e7b16049d28705e9834335dfce1db9fc2 (diff) |
printf("msg")/return 1 -> err(1, "msg"), which will also show relevant
errno string. Since we are err()'ing out, don't worry about closing
MBR fd first.
Diffstat (limited to 'sbin/fdisk/fdisk.c')
-rw-r--r-- | sbin/fdisk/fdisk.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/sbin/fdisk/fdisk.c b/sbin/fdisk/fdisk.c index 423680a2841..4fcb14a3dc3 100644 --- a/sbin/fdisk/fdisk.c +++ b/sbin/fdisk/fdisk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fdisk.c,v 1.52 2011/02/21 19:26:12 krw Exp $ */ +/* $OpenBSD: fdisk.c,v 1.53 2011/12/25 19:13:51 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -162,11 +162,9 @@ main(int argc, char *argv[]) memcpy(mbr_buf, builtin_mbr, sizeof(mbr_buf)); } else { error = MBR_read(fd, 0, mbr_buf); + if (error == -1) + err(1, "Unable to read MBR"); close(fd); - if (error == -1) { - printf("Unable to read MBR\n"); - return (1); - } } MBR_parse(&disk, mbr_buf, 0, 0, &mbr); |