Commit 476758e
committed
fix: drive encryption detection treated MODE SENSE success as failure
sg_modesense returns the transferred byte count (> 0) on success, but
is_ame and sg_set_key compared the result against 0/DEVICE_GOOD. is_ame
therefore always reported the drive as non-AME, and sg_set_key bailed
out before issuing SECURITY PROTOCOL OUT, so setting a data key always
failed on encrypting drives. Compare against < 0 like the other
sg_modesense callers, and normalize sg_set_key's success return.
Not verified on encrypting tape hardware; the logic follows the
documented sg_modesense return convention.1 parent f3fb8cc commit 476758e
1 file changed
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4630 | 4630 | | |
4631 | 4631 | | |
4632 | 4632 | | |
4633 | | - | |
| 4633 | + | |
| 4634 | + | |
| 4635 | + | |
4634 | 4636 | | |
4635 | 4637 | | |
4636 | 4638 | | |
| |||
4720 | 4722 | | |
4721 | 4723 | | |
4722 | 4724 | | |
4723 | | - | |
| 4725 | + | |
4724 | 4726 | | |
4725 | 4727 | | |
4726 | 4728 | | |
| |||
4767 | 4769 | | |
4768 | 4770 | | |
4769 | 4771 | | |
4770 | | - | |
| 4772 | + | |
4771 | 4773 | | |
| 4774 | + | |
4772 | 4775 | | |
4773 | 4776 | | |
4774 | 4777 | | |
| |||
0 commit comments