libqmi: file_open: fail if qmidev_set_dev_fd fails

We accidentally weren't checking the return value of qmidev_set_dev_fs.
It turns out that you can't add /dev/null to an epoll, but this tripped
an assert failure because we eventually called qmidev_clear_dev_fd without
having set the fd successfully.  With this patch, dev_open fails as it
should.

BUG=None
TEST=new version of qmidev_unittest fails better

Change-Id: Ic5746c976a3f74cb264c06a43a8846f97fd20219
diff --git a/src/file.c b/src/file.c
index f53eb16..ef873e1 100644
--- a/src/file.c
+++ b/src/file.c
@@ -36,8 +36,13 @@
   if (fd < 0)
     return errno;
 
+  int result = qmidev_set_dev_fd(priv->qmidev, fd);
+  if (result) {
+    close(fd);
+    return result;
+  }
+
   priv->fd = fd;
-  qmidev_set_dev_fd(priv->qmidev, fd);
 
   return 0;
 }
@@ -85,6 +90,7 @@
     return result;
 
   priv->fd = FD_CLOSED;
+
   qmidev_clear_dev_fd(priv->qmidev);
 
   return 0;