43 lines
1.7 KiB
Diff
43 lines
1.7 KiB
Diff
From d936fd78afb9d1fa68237367f33ebaa4f0ac1de4 Mon Sep 17 00:00:00 2001
|
|
From: samm-git <samm@os2.kiev.ua>
|
|
Date: Mon, 6 Nov 2017 22:06:52 +0000
|
|
Subject: [PATCH 004/291] os_linux.cpp/os_netbsd.cpp: fix crash on --scan if
|
|
WITH_NVME_DEVICESCAN is not set and '-d <type>' is not specified
|
|
|
|
git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@4599 4ea69e1a-61f1-4043-bf83-b5c94c648137
|
|
---
|
|
smartmontools/ChangeLog | 5 +++++
|
|
smartmontools/os_linux.cpp | 2 +-
|
|
smartmontools/os_netbsd.cpp | 2 +-
|
|
3 files changed, 7 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/smartmontools/os_linux.cpp b/smartmontools/os_linux.cpp
|
|
index 407f3cd2..46958ae0 100644
|
|
--- a/smartmontools/os_linux.cpp
|
|
+++ b/smartmontools/os_linux.cpp
|
|
@@ -3010,7 +3010,7 @@ bool linux_smart_interface::scan_smart_devices(smart_device_list & devlist,
|
|
#ifdef WITH_NVME_DEVICESCAN // TODO: Remove when NVMe support is no longer EXPERIMENTAL
|
|
bool scan_nvme = (!*type || !strcmp(type, "nvme"));
|
|
#else
|
|
- bool scan_nvme = ( !strcmp(type, "nvme"));
|
|
+ bool scan_nvme = (type && !strcmp(type, "nvme"));
|
|
#endif
|
|
|
|
if (!(scan_ata || scan_scsi || scan_nvme)) {
|
|
diff --git a/smartmontools/os_netbsd.cpp b/smartmontools/os_netbsd.cpp
|
|
index 4320cc47..4f8b2cbf 100644
|
|
--- a/smartmontools/os_netbsd.cpp
|
|
+++ b/smartmontools/os_netbsd.cpp
|
|
@@ -754,7 +754,7 @@ bool netbsd_smart_interface::scan_smart_devices(smart_device_list & devlist,
|
|
#ifdef WITH_NVME_DEVICESCAN // TODO: Remove when NVMe support is no longer EXPERIMENTAL
|
|
bool scan_nvme = !*type || !strcmp(type, "nvme");
|
|
#else
|
|
- bool scan_nvme = !strcmp(type, "nvme");
|
|
+ bool scan_nvme = type && !strcmp(type, "nvme");
|
|
#endif
|
|
|
|
// Make namelists
|
|
--
|
|
2.19.1
|
|
|