From 41b152c5f6ec3a5a6e51b4f8f0f90291a5895edc Mon Sep 17 00:00:00 2001 From: darylm503 Date: Mon, 3 Oct 2011 18:54:12 +0000 Subject: StdLib: Improve robustness of stat() and make basename() a public function. AppPkg: Refinements to pyconfig.h and port of getpath.c to EDK II. Signed-off-by: darylm503 Reviewed-by: geekboy15a Reviewed-by: jljusten git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12508 6f19259b-4bc3-4df7-8a09-765794883524 --- StdLib/LibC/Uefi/Devices/UefiShell/daShell.c | 4 ++-- StdLib/LibC/Uefi/SysCalls.c | 2 +- StdLib/LibC/Uefi/compat.c | 5 +---- 3 files changed, 4 insertions(+), 7 deletions(-) (limited to 'StdLib/LibC/Uefi') diff --git a/StdLib/LibC/Uefi/Devices/UefiShell/daShell.c b/StdLib/LibC/Uefi/Devices/UefiShell/daShell.c index d0abb8dd5b..de14ef31c5 100644 --- a/StdLib/LibC/Uefi/Devices/UefiShell/daShell.c +++ b/StdLib/LibC/Uefi/Devices/UefiShell/daShell.c @@ -304,14 +304,14 @@ da_ShellStat( } else { Status = RETURN_DEVICE_ERROR; + errno = EIO; } - errno = EFI2errno(Status); EFIerrno = Status; if(FileInfo != NULL) { FreePool(FileInfo); // Release the buffer allocated by the GetInfo function } - return errno? -1 : 0; + return (Status == RETURN_SUCCESS)? 0 : -1; } static diff --git a/StdLib/LibC/Uefi/SysCalls.c b/StdLib/LibC/Uefi/SysCalls.c index d52249b58b..b5079e2c3a 100644 --- a/StdLib/LibC/Uefi/SysCalls.c +++ b/StdLib/LibC/Uefi/SysCalls.c @@ -923,7 +923,7 @@ fstat (int fd, struct stat *statbuf) identify the error. **/ int -stat (const char *path, void *statbuf) +stat (const char *path, struct stat *statbuf) { int fd; int retval = -1; diff --git a/StdLib/LibC/Uefi/compat.c b/StdLib/LibC/Uefi/compat.c index 7f250d15ff..8ce4783a6a 100644 --- a/StdLib/LibC/Uefi/compat.c +++ b/StdLib/LibC/Uefi/compat.c @@ -94,6 +94,7 @@ #include #include #include +#include #ifndef HAVE_GETOPT char *optarg; @@ -138,11 +139,7 @@ getopt(int argc, char **argv, char *args) } #endif -#ifdef WIN32 #define ISPATHSEPARATOR(x) ((x == '/') || (x == '\\')) -#else -#define ISPATHSEPARATOR(x) (x == '/') -#endif #ifndef HAVE_BASENAME #ifndef PATH_MAX -- cgit v1.2.3