diff --git a/reactos/subsys/system/cmd/dir.c b/reactos/subsys/system/cmd/dir.c index def86ca8c0d..b7765c9d586 100644 --- a/reactos/subsys/system/cmd/dir.c +++ b/reactos/subsys/system/cmd/dir.c @@ -1,4 +1,4 @@ -/* $Id: dir.c,v 1.3 2003/08/07 09:27:42 hbirr Exp $ +/* $Id: dir.c,v 1.4 2003/10/18 17:59:29 ekohl Exp $ * * DIR.C - dir internal command. * @@ -381,7 +381,11 @@ DirParsePathspec (LPTSTR szPathspec, LPTSTR szPath, LPTSTR szFilespec) szRootPath[0] = szPathspec[0]; start = szPathspec + 2; - SetCurrentDirectory (szRootPath); + if (!SetCurrentDirectory (szRootPath)) + { + ErrorMessage (GetLastError(), NULL); + return 1; + } } else { diff --git a/reactos/subsys/system/cmd/error.c b/reactos/subsys/system/cmd/error.c index d0bf15b1e8f..154ae63b501 100644 --- a/reactos/subsys/system/cmd/error.c +++ b/reactos/subsys/system/cmd/error.c @@ -51,9 +51,12 @@ VOID ErrorMessage (DWORD dwErrorCode, LPTSTR szFormat, ...) if (dwErrorCode == ERROR_SUCCESS) return; - va_start (arg_ptr, szFormat); - _vstprintf (szMessage, szFormat, arg_ptr); - va_end (arg_ptr); + if (szFormat) + { + va_start (arg_ptr, szFormat); + _vstprintf (szMessage, szFormat, arg_ptr); + va_end (arg_ptr); + } #ifndef __REACTOS__ @@ -76,11 +79,15 @@ VOID ErrorMessage (DWORD dwErrorCode, LPTSTR szFormat, ...) switch (dwErrorCode) { case ERROR_FILE_NOT_FOUND: - szError = _T("File not found --"); + szError = _T("File not found"); break; case ERROR_PATH_NOT_FOUND: - szError = _T("Path not found --"); + szError = _T("Path not found"); + break; + + case ERROR_NOT_READY: + szError = _T("Drive not ready"); break; default: @@ -88,7 +95,10 @@ VOID ErrorMessage (DWORD dwErrorCode, LPTSTR szFormat, ...) return; } - ConErrPrintf (_T("%s %s\n"), szError, szMessage); + if (szFormat) + ConErrPrintf (_T("%s -- %s\n"), szError, szMessage); + else + ConErrPrintf (_T("%s\n"), szError); #endif }