From 003f8bb956e86c33cd75f2fad774082df5497fb4 Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac Date: Sun, 14 Jun 2015 00:52:49 +0200 Subject: [PATCH] File descriptor must be positive. --- src/modules/welcome/checker/partman_devices.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/modules/welcome/checker/partman_devices.c b/src/modules/welcome/checker/partman_devices.c index 98d50fd9c..c07eef460 100644 --- a/src/modules/welcome/checker/partman_devices.c +++ b/src/modules/welcome/checker/partman_devices.c @@ -1,6 +1,6 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Teo Mrnjavac + * Copyright 2014-2015, Teo Mrnjavac * * Based on parted_devices.c, from partman-base. * @@ -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;