hdt: Don't search HDDs when no HDD got detected
authorErwan Velu <erwanaliasr1@gmail.com>
Thu, 22 Sep 2011 18:52:49 +0000 (20:52 +0200)
committerErwan Velu <erwanaliasr1@gmail.com>
Thu, 22 Sep 2011 18:52:49 +0000 (20:52 +0200)
com32/hdt/hdt-dump-disks.c

index bde04d2..ff744b3 100644 (file)
@@ -123,7 +123,9 @@ void show_disk(struct s_hardware *hardware, ZZJSON_CONFIG *conf, ZZJSON **it, in
 
 void dump_disks(struct s_hardware *hardware, ZZJSON_CONFIG *config, ZZJSON **item) {
        bool found=false;
-       for (int drive = 0x80; drive < 0xff; drive++) {
+
+       if (hardware->disks_count > 0)  
+           for (int drive = 0x80; drive < 0xff; drive++) {
                if (hardware->disk_info[drive - 0x80].cbios) {
                        if (found==false) {
                                CREATE_NEW_OBJECT;