svn commit: r334384 - head/usr.sbin/devinfo
Warner Losh
imp at FreeBSD.org
Wed May 30 15:09:00 UTC 2018
Author: imp
Date: Wed May 30 15:08:59 2018
New Revision: 334384
URL: https://svnweb.freebsd.org/changeset/base/334384
Log:
devinfo_init() returns an errno, but doesn't set errno, so the error
message when it fails reflects some random thing rather than what it
returned. Set errno to the return value.
Modified:
head/usr.sbin/devinfo/devinfo.c
Modified: head/usr.sbin/devinfo/devinfo.c
==============================================================================
--- head/usr.sbin/devinfo/devinfo.c Wed May 30 15:08:46 2018 (r334383)
+++ head/usr.sbin/devinfo/devinfo.c Wed May 30 15:08:59 2018 (r334384)
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <err.h>
+#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -242,7 +243,7 @@ int
main(int argc, char *argv[])
{
struct devinfo_dev *root;
- int c, uflag;
+ int c, uflag, rv;
char *path = NULL;
uflag = 0;
@@ -268,8 +269,10 @@ main(int argc, char *argv[])
if (path && (rflag || uflag))
usage();
- if (devinfo_init())
+ if ((rv = devinfo_init()) != 0) {
+ errno = rv;
err(1, "devinfo_init");
+ }
if ((root = devinfo_handle_to_device(DEVINFO_ROOT_DEVICE)) == NULL)
errx(1, "can't find root device");
More information about the svn-src-all
mailing list