summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorImre Deak <imre.deak@intel.com>2020-07-07 16:18:13 +0300
committerImre Deak <imre.deak@intel.com>2020-07-08 13:01:20 +0300
commit48ad53e29fd49ec685f07242e6021b29e1d9a5d2 (patch)
tree2676f6e5fe4a93bb48e9f62459ed7d392969bc8d /lib
parentd0e473d7a6ef069b3ee097ebca1033c6bb9e7878 (diff)
lib/igt_chamelium: Duplicate the caller's drm_fd
Take a copy of the caller's FD so that the Chamelium lib functions can access the DRM file regardless of when the caller closes its own FD. This is needed at least by the next patch. Cc: Lyude Paul <lyude@redhat.com> Cc: Kunal Joshi <kunal1.joshi@intel.com> Signed-off-by: Imre Deak <imre.deak@intel.com> Reviewed-by: Kunal Joshi <kunal1.joshi@intel.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_chamelium.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
index 5924e5615..90a2d04bb 100644
--- a/lib/igt_chamelium.c
+++ b/lib/igt_chamelium.c
@@ -2485,7 +2485,7 @@ struct chamelium *chamelium_init(int drm_fd)
if (cleanup_instance)
chamelium_deinit(cleanup_instance);
- chamelium->drm_fd = drm_fd;
+ chamelium->drm_fd = dup(drm_fd);
IGT_INIT_LIST_HEAD(&chamelium->edids);
if (!chamelium_read_port_mappings(chamelium, drm_fd))
@@ -2511,6 +2511,8 @@ struct chamelium *chamelium_init(int drm_fd)
return chamelium;
error:
+ close(chamelium->drm_fd);
+
chamelium_deinit_rpc_only(chamelium);
return NULL;
@@ -2550,6 +2552,8 @@ void chamelium_deinit(struct chamelium *chamelium)
free(pos);
}
+ close(chamelium->drm_fd);
+
xmlrpc_client_destroy(chamelium->client);
for (i = 0; i < chamelium->port_count; i++)