[PATCH 09/46] gdbsupport, filestuff, ze: temporary files

Metzger, Markus T markus.t.metzger@intel.com
Fri Sep 6 14:52:00 GMT 2024


Hello Lancelot,

Thanks for your review.

>> +  ~tmpfilekeeper_s ()
>> +  {
>> +    for (const std::string& file : files)
>> +      unlink (file.c_str ());
>
>I am not entirely sure, but should the value returned by unlink be
>checked and some error/warning message printed if non-0?

I don't think we want to throw inside a dtor but a warning makes sense.


>> +  scoped_fd fd { gdb_mkostemp_cloexec (name.data (), O_BINARY) };
>> +  if (fd.get () == -1)
>> +    error (_("failed to create temporary file %s"), name.data ());
>
>Could be perror_with_name so it uses errno to build a better error message.

This won't allow me to add the filename unless I create the error string
in a string buffer.  I would rather add safe_strerror (errno) to the error
string.

Regards,
Markus.

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Sean Fennelly, Jeffrey Schneiderman, Tiffany Doon Silva
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


More information about the Gdb-patches mailing list