aboutsummaryrefslogtreecommitdiff
path: root/sbin/bsdlabel/bsdlabel.c
diff options
context:
space:
mode:
authorUlf Lilleengen <lulf@FreeBSD.org>2008-09-30 11:46:14 +0000
committerUlf Lilleengen <lulf@FreeBSD.org>2008-09-30 11:46:14 +0000
commit9d8ce0780024dd2307c45a0399bada4461fb68f8 (patch)
treeef5405996c9b4a7b96af27c15c56ff43d380f099 /sbin/bsdlabel/bsdlabel.c
parente45b2259ec3d7d128e1da66cf5b1a76f6618d9e9 (diff)
downloadsrc-9d8ce0780024dd2307c45a0399bada4461fb68f8.tar.gz
src-9d8ce0780024dd2307c45a0399bada4461fb68f8.zip
- A call to close(2) might overwrite errno and thus give a wrong error message
on g_providername failure. Suggested by: pjd Approved by: pjd (mentor)
Notes
Notes: svn path=/head/; revision=183496
Diffstat (limited to 'sbin/bsdlabel/bsdlabel.c')
-rw-r--r--sbin/bsdlabel/bsdlabel.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sbin/bsdlabel/bsdlabel.c b/sbin/bsdlabel/bsdlabel.c
index 97ddeb6aceb1..1cb99950bbd8 100644
--- a/sbin/bsdlabel/bsdlabel.c
+++ b/sbin/bsdlabel/bsdlabel.c
@@ -236,11 +236,12 @@ main(int argc, char *argv[])
return(1);
}
pname = g_providername(fd);
- close(fd);
if (pname == NULL) {
warn("error getting providername for %s", specname);
+ close(fd);
return(1);
}
+ close(fd);
}
if (installboot && op == UNSPEC)