cd rom handling: refactor cd rom path helper function

to stop returning results of assignments

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
This commit is contained in:
Stefan Sterz 2022-12-20 11:30:37 +01:00 committed by Thomas Lamprecht
parent 259470ee41
commit 490b730854

View File

@ -1289,12 +1289,16 @@ sub get_cdrom_path {
return $cdrom_path if defined($cdrom_path); return $cdrom_path if defined($cdrom_path);
return $cdrom_path = "/dev/cdrom" if -l "/dev/cdrom"; if (-l "/dev/cdrom") {
return $cdrom_path = "/dev/cdrom1" if -l "/dev/cdrom1"; $cdrom_path = "/dev/cdrom";
return $cdrom_path = "/dev/cdrom2" if -l "/dev/cdrom2"; } elsif (-l "/dev/cdrom1") {
$cdrom_path = "/dev/cdrom1";
} elsif (-l "/dev/cdrom2") {
$cdrom_path = "/dev/cdrom2";
} else {
log_warn("no physical CD-ROM available, ignoring"); log_warn("no physical CD-ROM available, ignoring");
$cdrom_path = ''; $cdrom_path = '';
}
return $cdrom_path; return $cdrom_path;
} }