Code

disk plugin: Call disk_udev_attr_name() only when UdevNameAttr configured
authorPavel Rochnyack <pavel2000@ngs.ru>
Wed, 25 May 2016 07:15:31 +0000 (13:15 +0600)
committerPavel Rochnyack <pavel2000@ngs.ru>
Wed, 25 May 2016 07:15:31 +0000 (13:15 +0600)
src/disk.c

index 0d6248866efa0671be1ceb01a64fb3edb808d9dd..07383c75d7b0b833a455a6c9c347f815a4b34c74 100644 (file)
@@ -867,9 +867,13 @@ static int disk_read (void)
                output_name = disk_name;
 
 #if HAVE_LIBUDEV
-               char *alt_name = disk_udev_attr_name (handle_udev, disk_name, conf_udev_name_attr);
-               if (alt_name != NULL)
-                       output_name = alt_name;
+               char *alt_name = NULL;
+               if (conf_udev_name_attr != NULL)
+               {
+                       alt_name = disk_udev_attr_name (handle_udev, disk_name, conf_udev_name_attr);
+                       if (alt_name != NULL)
+                               output_name = alt_name;
+               }
 #endif
 
                if (ignorelist_match (ignorelist, output_name) != 0)