When autoclose is set (kernel default) opening a CD-rom
device causes the tray to close.
Signed-off-by: changlianzhi <changlianzhi@uniontech.com>
{
int fd, ret;
- if ((fd = open(device, O_RDONLY)) < 0)
+ if ((fd = open(device, O_RDONLY|O_NONBLOCK)) < 0)
return 0;
ret = blkdev_is_cdrom(fd);
if ((stat(device, &st_buf) != 0) ||
!S_ISBLK(st_buf.st_mode))
return 0;
- fd = open(device, O_RDONLY|O_EXCL|O_CLOEXEC);
+ fd = open(device, O_RDONLY|O_EXCL|O_CLOEXEC|O_NONBLOCK);
if (fd < 0) {
if (errno == EBUSY)
*mount_flags |= MF_BUSY;