From: Bartosz Kosiorek gang65@poczta.onet.pl
--- dlls/msvcrt/dir.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/dlls/msvcrt/dir.c b/dlls/msvcrt/dir.c index 91aaaf5ff18..97db409bb60 100644 --- a/dlls/msvcrt/dir.c +++ b/dlls/msvcrt/dir.c @@ -790,19 +790,23 @@ char* CDECL _getcwd(char * buf, int size) int dir_len = GetCurrentDirectoryA(MAX_PATH,dir);
if (dir_len < 1) - return NULL; /* FIXME: Real return value untested */ + return NULL;
if (!buf) { if (size <= dir_len) size = dir_len + 1; - if (!(buf = malloc( size ))) return NULL; + if (!(buf = malloc( size ))) + { + *_errno() = ENOMEM; + return NULL; + } } else if (dir_len >= size) { *_errno() = ERANGE; return NULL; /* buf too small */ } - strcpy(buf,dir); + strcpy(buf, dir); return buf; }
@@ -858,7 +862,7 @@ int CDECL _getdrive(void) * _getdcwd (MSVCRT.@) * * Get the current working directory on a given disk. - * + * * PARAMS * drive [I] Drive letter to get the current working directory from. * buf [O] Destination for the current working directory.