Skip to content
Snippets Groups Projects
Commit 02383569 authored by dlukes's avatar dlukes
Browse files

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
parent ee7d326e
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment