diff options
author | Ray Lai <ray@cvs.openbsd.org> | 2006-07-27 04:06:14 +0000 |
---|---|---|
committer | Ray Lai <ray@cvs.openbsd.org> | 2006-07-27 04:06:14 +0000 |
commit | 336c2dcb40bbb1fe30f92e79fbbd31123b292e55 (patch) | |
tree | 0fade1029a907c024795bfc826ef625619661fa5 /sbin/fdisk/fdisk.c | |
parent | 3fcc141342739b3bffb3270bf5fe2e0088182201 (diff) |
Add checks to each write(2) attempt and try to keep fdisk in a
consistent state upon write failure.
OK krw@ and deraadt@.
Diffstat (limited to 'sbin/fdisk/fdisk.c')
-rw-r--r-- | sbin/fdisk/fdisk.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sbin/fdisk/fdisk.c b/sbin/fdisk/fdisk.c index d2a7f3ce7c6..7a0aa9ef10a 100644 --- a/sbin/fdisk/fdisk.c +++ b/sbin/fdisk/fdisk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fdisk.c,v 1.41 2006/07/09 21:19:41 miod Exp $ */ +/* $OpenBSD: fdisk.c,v 1.42 2006/07/27 04:06:13 ray Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -162,7 +162,8 @@ main(int argc, char *argv[]) /* Now do what we are supposed to */ if (i_flag || u_flag) - USER_init(&disk, &mbr, u_flag); + if (USER_init(&disk, &mbr, u_flag) == -1) + err(1, "error initializing MBR"); if (m_flag) USER_modify(&disk, &mbr, 0, 0); |