summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cpukit/libmisc/shell/shell_getprompt.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/cpukit/libmisc/shell/shell_getprompt.c b/cpukit/libmisc/shell/shell_getprompt.c
index 08c628b219..357bb1a3ad 100644
--- a/cpukit/libmisc/shell/shell_getprompt.c
+++ b/cpukit/libmisc/shell/shell_getprompt.c
@@ -37,13 +37,15 @@ void rtems_shell_get_prompt(
size_t size
)
{
- char curdir[256];
+ char buf[256];
+ char *cwd;
/* XXX: show_prompt user adjustable */
- getcwd(curdir,sizeof(curdir));
+ cwd = getcwd(buf,sizeof(buf));
+ cwd = cwd != NULL ? cwd : "?";
snprintf(prompt, size - 1, "%s%s[%s] %c ",
((shell_env->taskname) ? shell_env->taskname : ""),
((shell_env->taskname) ? " " : ""),
- curdir,
+ cwd,
geteuid()?'$':'#');
}