--- ddrutility-2.8.orig/ddru_diskutility.c 2026-11-06 14:25:32.902886674 -0600 +++ ddrutility-2.8/ddru_diskutility.c 2026-11-06 14:25:32.945096719 -0600 @@ -389,22 +389,24 @@ // also works to tell if whole drive or partition if (sgpt) { - // extract last part of device name + // extract last part of device name, after following any link such as /dev/disk/by-id + char resolved_disk[4096]; + const char *device_path = realpath(source_disk, resolved_disk) ? resolved_disk : source_disk; int i = 0; - while (source_disk[i] != '\0') + while (device_path[i] != '\0') i++; - while (source_disk[i] != '/') + while (device_path[i] != '/') { i--; if (i < 0) break; } - char device_name[20]; + char device_name[256]; i++; int n = 0; - while (source_disk[i] != '\0') + while (device_path[i] != '\0') { - device_name[n] = source_disk[i]; + device_name[n] = device_path[i]; n++; i++; } @@ -412,7 +414,7 @@ // whether scsi or ata we need to get the buffer limit that the kernel uses // and we can also use this to find out if whole disk or partition - char file_name[80] = "/sys/block/\0"; + char file_name[320] = "/sys/block/\0"; strcat (file_name, device_name); strcat (file_name, "/queue/max_sectors_kb"); @@ -697,9 +699,9 @@ scsi_cmd[0] = 0xA1; // ata passthough 12 command scsi_cmd[1] = 0x08; // set protocol to 4, PIO Data-In - scsi_cmd[2] = (1<<5)+(1<<3); // set check condition, direction (1 from device, 0 to device) + scsi_cmd[2] = (1<<5)+(1<<3)+(1<<2)+2; // set check condition, direction (1 from device, 0 to device), block units, length in the sector count field scsi_cmd[3] = 0; - scsi_cmd[4] = 0; + scsi_cmd[4] = 1; // one sector; current libata refuses a PIO data-in command that declares no length scsi_cmd[5] = 0; scsi_cmd[6] = 0; scsi_cmd[7] = 0;