session,daemon,daemon-handover: Always check fd list and index before acquiring the fd itself
Quoting the main commit here
g_unix_fd_list_get() requires the file descriptor list and index to be
valid. If they are invalid (e.g. index is out of range), it returns -1
as fd, but the call does not set the error.
Thus, gnome-remote-desktop crashes, when attempting to print the error
message to the journal.
Fix this issue by simply checking the file descriptor index before
attempting to acquire the file descriptor itself.
Fixes: https://errors.ubuntu.com/problem/e7b4b4292726923600ac46a21ef9b94f868951f3