about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/mdevd/mdevd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mdevd/mdevd.c b/src/mdevd/mdevd.c
index ba65fe8..06324eb 100644
--- a/src/mdevd/mdevd.c
+++ b/src/mdevd/mdevd.c
@@ -537,7 +537,7 @@ static inline int wait_for_loading (char const *sysdevpath, size_t sysdevpathlen
     tain_add_g(&deadline, &period) ;
     deepsleepuntil_g(&deadline) ;
   }
-  if (ndelay_off(lfd) < 0)
+  if (lfd >= 0 && ndelay_off(lfd) < 0)
   {
     fd_close(lfd) ;
     return -1 ;