From 7a28608cfded6ad958b67771de221d7e4f65d5a4 Mon Sep 17 00:00:00 2001 From: Philip Guenther Date: Sun, 20 Jul 2014 01:38:41 +0000 Subject: Make sure the correct errno is reported by warn* or err* and not the errno of an intervening cleanup operation like close/unlink/etc. Diff from Doug Hogan (doug (at) acyclic.org) --- sbin/disklabel/disklabel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sbin/disklabel') diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c index e3daa538332..6955b45db66 100644 --- a/sbin/disklabel/disklabel.c +++ b/sbin/disklabel/disklabel.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.c,v 1.195 2014/05/05 16:33:34 krw Exp $ */ +/* $OpenBSD: disklabel.c,v 1.196 2014/07/20 01:38:40 guenther Exp $ */ /* * Copyright (c) 1987, 1993 @@ -816,9 +816,9 @@ edit(struct disklabel *lp, int f) u_int64_t total_sectors, starting_sector, ending_sector; if ((fd = mkstemp(tmpfil)) == -1 || (fp = fdopen(fd, "w")) == NULL) { + warn("%s", tmpfil); if (fd != -1) close(fd); - warn("%s", tmpfil); return (1); } display(fp, lp, 0, 1); -- cgit v1.2.3