mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-29 02:15:36 -04:00
File descriptor must be positive.
This commit is contained in:
parent
624e4f9421
commit
003f8bb956
1 changed files with 6 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
|||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
|
||||
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
||||
*
|
||||
* Based on parted_devices.c, from partman-base.
|
||||
* <http://anonscm.debian.org/cgit/d-i/partman-base.git>
|
||||
|
@ -48,8 +48,11 @@ is_cdrom(const char *path)
|
|||
int ret;
|
||||
|
||||
fd = open(path, O_RDONLY | O_NONBLOCK);
|
||||
ret = ioctl(fd, CDROM_GET_CAPABILITY, NULL);
|
||||
close(fd);
|
||||
if (fd >= 0)
|
||||
{
|
||||
ret = ioctl(fd, CDROM_GET_CAPABILITY, NULL);
|
||||
close(fd);
|
||||
}
|
||||
|
||||
if (ret >= 0)
|
||||
return 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue