removable devices can may return 0 sectors in scsionline when they have empty media. prevent infinite loops. ahci+sata lg super multi dvd rewriter do this, e.g. Notes: Wed Aug 8 18:50:35 EDT 2007 geoff applied in slightly different form. Reference: /n/sources/patch/applied/scsionline-removeable Date: Wed Aug 8 16:43:35 CES 2007 Signed-off-by: quanstro@quanstro.net Reviewed-by: geoff --- /sys/src/9/pc/sdscsi.c Wed Aug 8 16:39:11 2007 +++ /sys/src/9/pc/sdscsi.c Wed Aug 8 16:39:08 2007 @@ -215,8 +215,10 @@ break; case 0: unit->sectors = (p[0]<<24)|(p[1]<<16)|(p[2]<<8)|p[3]; - if(unit->sectors == 0) - continue; + if(unit->sectors == 0){ + ok = 1; + break; + } /* * Read-capacity returns the LBA of the last sector, * therefore the number of sectors must be incremented.