Return gdb::optional<std::string> from target_fileio_readlink
[deliverable/binutils-gdb.git] / gdb / target.c
index 197e7ff5420e63e04e70495b903595be45381c7d..2b97118217359f696ac40acced03e4e5bf5e2dd8 100644 (file)
@@ -3059,7 +3059,7 @@ target_fileio_unlink (struct inferior *inf, const char *filename,
 
 /* See target.h.  */
 
-char *
+gdb::optional<std::string>
 target_fileio_readlink (struct inferior *inf, const char *filename,
                        int *target_errno)
 {
@@ -3069,22 +3069,22 @@ target_fileio_readlink (struct inferior *inf, const char *filename,
     {
       if (t->to_fileio_readlink != NULL)
        {
-         char *ret = t->to_fileio_readlink (t, inf, filename,
-                                            target_errno);
+         gdb::optional<std::string> ret
+           = t->to_fileio_readlink (t, inf, filename, target_errno);
 
          if (targetdebug)
            fprintf_unfiltered (gdb_stdlog,
                                "target_fileio_readlink (%d,%s)"
                                " = %s (%d)\n",
                                inf == NULL ? 0 : inf->num,
-                               filename, ret? ret : "(nil)",
-                               ret? 0 : *target_errno);
+                               filename, ret ? ret->c_str () : "(nil)",
+                               ret ? 0 : *target_errno);
          return ret;
        }
     }
 
   *target_errno = FILEIO_ENOSYS;
-  return NULL;
+  return {};
 }
 
 static void
This page took 0.024265 seconds and 4 git commands to generate.