mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-25 01:31:08 +00:00
tweak for correct strerror_r
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35086 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
5213484aa5
commit
99f4373333
1 changed files with 16 additions and 7 deletions
|
@ -26,16 +26,23 @@
|
||||||
/* Carefully turn on _XOPEN_SOURCE for string.h so we
|
/* Carefully turn on _XOPEN_SOURCE for string.h so we
|
||||||
* get the POSIX strerror_r
|
* get the POSIX strerror_r
|
||||||
*/
|
*/
|
||||||
#ifdef _XOPEN_SOURCE
|
#if defined(_GNU_SOURCE)
|
||||||
#undef _XOPEN_SOURCE
|
#undef _GNU_SOURCE
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(_XOPEN_SOURCE)
|
||||||
|
#if _XOPEN_SOURCE < 600
|
||||||
|
#undef _XOPEN_SOURCE
|
||||||
#define _XOPEN_SOURCE 600
|
#define _XOPEN_SOURCE 600
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define _XOPEN_SOURCE 600
|
||||||
|
#endif
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#import "common.h"
|
#import "common.h"
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#import "Foundation/NSDictionary.h"
|
#import "Foundation/NSDictionary.h"
|
||||||
#import "Foundation/NSError.h"
|
#import "Foundation/NSError.h"
|
||||||
|
@ -123,10 +130,12 @@ strerror_r(int eno, char *buf, int len)
|
||||||
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
||||||
NULL, code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
NULL, code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||||
(LPWSTR) &lpMsgBuf, 0, NULL );
|
(LPWSTR) &lpMsgBuf, 0, NULL );
|
||||||
if (lpMsgBuf != NULL) {
|
if (lpMsgBuf != NULL)
|
||||||
message = [NSString stringWithCharacters: lpMsgBuf length: wcslen(lpMsgBuf)];
|
{
|
||||||
LocalFree(lpMsgBuf);
|
message
|
||||||
}
|
= [NSString stringWithCharacters: lpMsgBuf length: wcslen(lpMsgBuf)];
|
||||||
|
LocalFree(lpMsgBuf);
|
||||||
|
}
|
||||||
info = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
info = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||||
message, NSLocalizedDescriptionKey,
|
message, NSLocalizedDescriptionKey,
|
||||||
nil];
|
nil];
|
||||||
|
|
Loading…
Reference in a new issue