File descriptor must be positive.

This commit is contained in:
Teo Mrnjavac 2015-06-14 00:52:49 +02:00
parent 624e4f9421
commit 003f8bb956

View File

@ -1,6 +1,6 @@
/* === This file is part of Calamares - <http://github.com/calamares> === /* === 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. * Based on parted_devices.c, from partman-base.
* <http://anonscm.debian.org/cgit/d-i/partman-base.git> * <http://anonscm.debian.org/cgit/d-i/partman-base.git>
@ -48,8 +48,11 @@ is_cdrom(const char *path)
int ret; int ret;
fd = open(path, O_RDONLY | O_NONBLOCK); fd = open(path, O_RDONLY | O_NONBLOCK);
ret = ioctl(fd, CDROM_GET_CAPABILITY, NULL); if (fd >= 0)
close(fd); {
ret = ioctl(fd, CDROM_GET_CAPABILITY, NULL);
close(fd);
}
if (ret >= 0) if (ret >= 0)
return 1; return 1;