From 313ffb4fb35e8f986139a05b4e1017899cdd2356 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 27 Sep 2009 18:06:40 +0800 Subject: [PATCH] Debug --- Kernel/vfs/open.c | 1 + Usermode/Applications/CLIShell_src/main.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/Kernel/vfs/open.c b/Kernel/vfs/open.c index 2a3359f8..d6a0fd4f 100644 --- a/Kernel/vfs/open.c +++ b/Kernel/vfs/open.c @@ -121,6 +121,7 @@ char *VFS_GetAbsPath(char *Path) // `ret` should now be the absolute path LEAVE('s', ret); + Log("VFS_GetAbsPath: RETURN '%s'", ret); return ret; } diff --git a/Usermode/Applications/CLIShell_src/main.c b/Usermode/Applications/CLIShell_src/main.c index becbe80b..8298c2a0 100644 --- a/Usermode/Applications/CLIShell_src/main.c +++ b/Usermode/Applications/CLIShell_src/main.c @@ -77,6 +77,11 @@ int main(int argc, char *argv[], char *envp[]) // Read Command line sCommandStr = ReadCommandLine( &length ); + if(!sCommandStr) { + write(_stdout, 25, "PANIC: Out of heap space\n"); + return -1; + } + // Check if the command should be cached if(gasCommandHistory == NULL || strcmp(sCommandStr, gasCommandHistory[giLastCommand]) != 0) { @@ -197,6 +202,12 @@ void Parse_Args(char *str, char **dest) int i = 1; char *buf = malloc( strlen(str) + 1 ); + if(buf == NULL) { + dest[0] = NULL; + Print("Parse_Args: Out of heap space!\n"); + return ; + } + strcpy(buf, str); dest[0] = buf; -- 2.20.1