Commit 48ad53e2 authored by Imre Deak's avatar Imre Deak

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's avatarImre Deak <imre.deak@intel.com>
Reviewed-by: KunalJoshi95's avatarKunal Joshi <kunal1.joshi@intel.com>
parent d0e473d7
......@@ -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++)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment