gdbsupport: make gdb_open_cloexec return scoped_fd

Make gdb_open_cloexec return a scoped_fd, to encourage using automatic
management of the file descriptor closing.  Except in the most trivial
cases, I changed the callers to just release the fd, which retains their
existing behavior.  That will allow the transition to using scoped_fd
more to go gradually, one caller at a time.

Change-Id: Ife022b403f96e71d5ebb4f1056ef6251b30fe554
This commit is contained in:
Simon Marchi
2021-07-22 11:56:33 -04:00
parent e6e51c9c4b
commit 13084383e8
16 changed files with 41 additions and 50 deletions

View File

@@ -3832,7 +3832,7 @@ linux_proc_xfer_memory_partial_pid (ptid_t ptid,
"/proc/%d/task/%ld/mem", ptid.pid (), ptid.lwp ());
last_proc_mem_file.fd
= gdb_open_cloexec (filename, O_RDWR | O_LARGEFILE, 0);
= gdb_open_cloexec (filename, O_RDWR | O_LARGEFILE, 0).release ();
if (last_proc_mem_file.fd == -1)
{