From 0238356954b54b593185ef867a9f47aaccce7e15 Mon Sep 17 00:00:00 2001
From: dlukes <dlukes@4ea69e1a-61f1-4043-bf83-b5c94c648137>
Date: Thu, 18 Dec 2008 03:40:05 +0000
Subject: [PATCH] scanning devices for legacy os-* interface is broken

because legacy_smart_interface::scan_smart_devices is called with type==NULL
and get_ata_device(atanames[i], type) called within it abends because of
such NULL:

Smartd: Exception: basic_string::_S_construct NULL not valid

As I workaround the NULL type is set to ""


git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@2687 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
 sm5/dev_legacy.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sm5/dev_legacy.cpp b/sm5/dev_legacy.cpp
index 2763907a4..1e5fce99d 100644
--- a/sm5/dev_legacy.cpp
+++ b/sm5/dev_legacy.cpp
@@ -24,7 +24,7 @@
 #include "dev_interface.h"
 #include "dev_ata_cmd_set.h"
 
-const char * dev_legacy_cpp_cvsid = "$Id: dev_legacy.cpp,v 1.1 2008/07/25 21:16:00 chrfranke Exp $"
+const char * dev_legacy_cpp_cvsid = "$Id: dev_legacy.cpp,v 1.2 2008/12/18 03:40:05 dlukes Exp $"
   DEV_INTERFACE_H_CVSID;
 
 extern smartmonctrl * con; // con->reportscsiioctl
@@ -518,7 +518,7 @@ smart_device * legacy_smart_interface::autodetect_smart_device(const char * name
 
 static void free_devnames(char * * devnames, int numdevs)
 {
-  static const char version[] = "$Id: dev_legacy.cpp,v 1.1 2008/07/25 21:16:00 chrfranke Exp $";
+  static const char version[] = "$Id: dev_legacy.cpp,v 1.2 2008/12/18 03:40:05 dlukes Exp $";
   for (int i = 0; i < numdevs; i++)
     FreeNonZero(devnames[i], -1,__LINE__, version);
   FreeNonZero(devnames, (sizeof (char*) * numdevs),__LINE__, version);
@@ -554,6 +554,8 @@ bool legacy_smart_interface::scan_smart_devices(smart_device_list & devlist,
 
   // Add to devlist
   int i;
+  if (type==NULL)
+    type="";
   for (i = 0; i < numata; i++) {
     ata_device * atadev = get_ata_device(atanames[i], type);
     if (atadev)
-- 
GitLab