Skip to content

Commit

Permalink
accept symlinks to block devices and files in dialogs (bsc#1123316)
Browse files Browse the repository at this point in the history
Ruby's File.ftype does not follow symlinks.
  • Loading branch information
wfeldt committed Feb 20, 2019
1 parent 7e62818 commit 3744329
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/include/iscsi-lio-server/UI_dialogs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2710,8 +2710,7 @@ def validate
@lun_path_input.value = nil
return false
end
file_type = File.ftype(file)
if (file_type != 'blockSpecial') && (file_type != 'file')
if !File.file?(file) && !File.blockdev?(file)
Yast::Popup.Error(_('Please provide a normal file or a block device.'))
@lun_path_input.value = nil
return false
Expand All @@ -2727,8 +2726,7 @@ def is_valid
if !(File.exist?(file))
return false
end
file_type = File.ftype(file)
if (file_type != 'blockSpecial') && (file_type != 'file')
if !File.file?(file) && !File.blockdev?(file)
return false
end
true
Expand Down Expand Up @@ -2883,7 +2881,7 @@ def handle(event)
lun_name = ret[1]
file = ret[2]
if !file.nil? && (File.exist?(file))
@lun_table.add_lun_item([rand(9999), lun_number, lun_name, file, File.ftype(file)])
@lun_table.add_lun_item([rand(9999), lun_number, lun_name, file, File.stat(file).ftype])
end
end
when :delete
Expand Down

0 comments on commit 3744329

Please sign in to comment.