aboutsummaryrefslogtreecommitdiff
path: root/gdb/mi/mi-cmd-env.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/mi/mi-cmd-env.c')
-rw-r--r--gdb/mi/mi-cmd-env.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gdb/mi/mi-cmd-env.c b/gdb/mi/mi-cmd-env.c
index 977b6e2..0d08bb8 100644
--- a/gdb/mi/mi-cmd-env.c
+++ b/gdb/mi/mi-cmd-env.c
@@ -74,11 +74,12 @@ mi_cmd_env_pwd (const char *command, char **argv, int argc)
/* Otherwise the mi level is 2 or higher. */
- if (! getcwd (gdb_dirbuf, sizeof (gdb_dirbuf)))
+ gdb::unique_xmalloc_ptr<char> cwd (getcwd (NULL, 0));
+ if (cwd == NULL)
error (_("-environment-pwd: error finding name of working directory: %s"),
safe_strerror (errno));
-
- uiout->field_string ("cwd", gdb_dirbuf);
+
+ uiout->field_string ("cwd", cwd.get ());
}
/* Change working directory. */