set right errorlevel for cd / chdir, left to do we do not have /d param
that are new in win2k maby in older windows also
Modified: trunk/reactos/subsys/system/cmd/internal.c
_____
Modified: trunk/reactos/subsys/system/cmd/internal.c
--- trunk/reactos/subsys/system/cmd/internal.c 2005-07-06 19:42:41 UTC
(rev 16462)
+++ trunk/reactos/subsys/system/cmd/internal.c 2005-07-06 20:15:36 UTC
(rev 16463)
@@ -172,6 +172,8 @@
return 0;
}
+ nErrorLevel = 0;
+
/* The whole param string is our parameter these days. The only
thing we do is eliminating every quotation mark */
/* Is it safe to change the characters param is pointing to? I
presume it is, as there doesn't seem to be any
post-processing of it after the function call (what would that
accomplish?) */
@@ -258,13 +260,14 @@
{
hSearch = FindFirstFile(dir, &FileData);
- if (hSearch == INVALID_HANDLE_VALUE)
- {
+ if (hSearch == INVALID_HANDLE_VALUE)
+ {
ConOutFormatMessage(GetLastError());
- free (lpOldPath);
- lpOldPath = NULL;
- return 1;
- }
+ free (lpOldPath);
+ lpOldPath = NULL;
+ nErrorLevel = 1;
+ return 1;
+ }
while (!fFinished)
@@ -282,6 +285,7 @@
ConOutFormatMessage(GetLastError());
free (lpOldPath);
lpOldPath = NULL;
+ nErrorLevel = 1;
return 1;
}
@@ -293,6 +297,7 @@
{
FindClose(hSearch);
ConOutFormatMessage(GetLastError());
+ nErrorLevel = 1;
free (lpOldPath);
lpOldPath = NULL;
return 1;
@@ -301,6 +306,7 @@
//ErrorMessage (GetLastError(), _T("CD"));
ConOutFormatMessage(GetLastError());
+ nErrorLevel = 1;
/* throw away current directory */
free (lpOldPath);