From a648fac32d493d99003c83ea1b250606886b6bd4 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Wed, 17 Jul 2013 23:14:41 +0000 Subject: [PATCH] Always initialize fd to 0 in open_dev(). Sponsored by: Intel Reviewed by: carl MFC after: 3 days --- sbin/nvmecontrol/nvmecontrol.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sbin/nvmecontrol/nvmecontrol.c b/sbin/nvmecontrol/nvmecontrol.c index 63cec3ce82cb..826195d837c4 100644 --- a/sbin/nvmecontrol/nvmecontrol.c +++ b/sbin/nvmecontrol/nvmecontrol.c @@ -166,6 +166,8 @@ open_dev(const char *str, int *fd, int show_error, int exit_on_error) struct stat devstat; char full_path[64]; + *fd = 0; + if (!strnstr(str, NVME_CTRLR_PREFIX, strlen(NVME_CTRLR_PREFIX))) { if (show_error) warnx("controller/namespace ids must begin with '%s'",