From 24b237331a679a2e1d7f80d2b3168622784b084a Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Wed, 6 Mar 2019 08:33:14 +0000 Subject: win32: drop argument from err_win_to_posix() --- include/mingw.h | 2 +- win32/mingw.c | 10 +++++----- win32/process.c | 4 ++-- win32/statfs.c | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/mingw.h b/include/mingw.h index f99582ca5..188d4eecf 100644 --- a/include/mingw.h +++ b/include/mingw.h @@ -506,7 +506,7 @@ static inline char *auto_win32_extension(const char *p) void convert_slashes(char *p) FAST_FUNC; size_t remove_cr(char *p, size_t len) FAST_FUNC; -int err_win_to_posix(DWORD winerr); +int err_win_to_posix(void); ULONGLONG CompatGetTickCount64(void); #define GetTickCount64 CompatGetTickCount64 diff --git a/win32/mingw.c b/win32/mingw.c index 11cef0abe..240f87b21 100644 --- a/win32/mingw.c +++ b/win32/mingw.c @@ -28,10 +28,10 @@ unsigned int _CRT_fmode = _O_BINARY; smallint bb_got_signal; -int err_win_to_posix(DWORD winerr) +int err_win_to_posix(void) { int error = ENOSYS; - switch(winerr) { + switch(GetLastError()) { case ERROR_ACCESS_DENIED: error = EACCES; break; case ERROR_ACCOUNT_DISABLED: error = EACCES; break; case ERROR_ACCOUNT_RESTRICTION: error = EACCES; break; @@ -675,7 +675,7 @@ int utimes(const char *file_name, const struct timeval tims[2]) fh = CreateFile(file_name, FILE_WRITE_ATTRIBUTES, 0, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); if ( fh == INVALID_HANDLE_VALUE ) { - errno = err_win_to_posix(GetLastError()); + errno = err_win_to_posix(); return -1; } @@ -992,7 +992,7 @@ int link(const char *oldpath, const char *newpath) return -1; } if (!CreateHardLinkA(newpath, oldpath, NULL)) { - errno = err_win_to_posix(GetLastError()); + errno = err_win_to_posix(); return -1; } return 0; @@ -1021,7 +1021,7 @@ static char *resolve_symlinks(char *path) } } - errno = err_win_to_posix(GetLastError()); + errno = err_win_to_posix(); return NULL; } diff --git a/win32/process.c b/win32/process.c index 33ae13ab4..d0fcc1c80 100644 --- a/win32/process.c +++ b/win32/process.c @@ -590,7 +590,7 @@ static int kill_pids(pid_t pid, int exit_code, kill_callback killer) HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if (snapshot == INVALID_HANDLE_VALUE) { - errno = err_win_to_posix(GetLastError()); + errno = err_win_to_posix(); return -1; } @@ -623,7 +623,7 @@ static int kill_pids(pid_t pid, int exit_code, kill_callback killer) for (i = len - 1; i >= 0; i--) { SetLastError(0); if (killer(pids[i], exit_code)) { - errno = err_win_to_posix(GetLastError()); + errno = err_win_to_posix(); ret = -1; } } diff --git a/win32/statfs.c b/win32/statfs.c index 4e5e4612d..d81a69380 100644 --- a/win32/statfs.c +++ b/win32/statfs.c @@ -21,13 +21,13 @@ int statfs(const char *file, struct statfs *buf) if ( !GetDiskFreeSpaceEx(file, (PULARGE_INTEGER) &free_bytes_available, (PULARGE_INTEGER) &total_number_of_bytes, (PULARGE_INTEGER) &total_number_of_free_bytes) ) { - errno = err_win_to_posix(GetLastError()); + errno = err_win_to_posix(); return -1; } if ( !GetVolumeInformation(file, NULL, 0, &serial, &namelen, &flags, fsname, 100) ) { - errno = err_win_to_posix(GetLastError()); + errno = err_win_to_posix(); return -1; } -- cgit v1.2.3-55-g6feb