mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
improve system error messages
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35764 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
21bd77c921
commit
3f773a24fc
9 changed files with 65 additions and 36 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
|||
2012-10-30 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/Additions/NSError+GNUstepBase.m:
|
||||
* Source/GSFileHandle.m:
|
||||
* Source/GSMDNSNetServices.m:
|
||||
* Source/NSMessagePort.m:
|
||||
* Source/NSSocketPort.m:
|
||||
* Source/NSSocketPortNameServer.m:
|
||||
* Source/NSThread.m:
|
||||
* Source/common.h:
|
||||
Changes to try to get inclusion of system specific features right.
|
||||
In particular, we want strerror_r() to be POSIX complient so that
|
||||
we get correct system erorr messages.
|
||||
|
||||
2012-10-28 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Headers/Foundation/NSGeometry.m: Fix so that an empty rect can never
|
||||
|
|
|
@ -23,23 +23,7 @@
|
|||
|
||||
*/
|
||||
|
||||
/* Carefully turn on _XOPEN_SOURCE for string.h so we
|
||||
* get the POSIX strerror_r
|
||||
*/
|
||||
#if defined(_GNU_SOURCE)
|
||||
#undef _GNU_SOURCE
|
||||
#endif
|
||||
#if defined(_XOPEN_SOURCE)
|
||||
#if _XOPEN_SOURCE < 600
|
||||
#undef _XOPEN_SOURCE
|
||||
#define _XOPEN_SOURCE 600
|
||||
#endif
|
||||
#else
|
||||
#define _XOPEN_SOURCE 600
|
||||
#endif
|
||||
|
||||
#import "common.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#import "Foundation/NSDictionary.h"
|
||||
|
@ -144,10 +128,12 @@ strerror_r(int eno, char *buf, int len)
|
|||
#else
|
||||
NSString *message;
|
||||
char buf[BUFSIZ];
|
||||
int result;
|
||||
|
||||
/* FIXME ... not all are POSIX, should we use NSMachErrorDomain for some? */
|
||||
domain = NSPOSIXErrorDomain;
|
||||
if (strerror_r(code, buf, BUFSIZ) < 0)
|
||||
result = strerror_r(code, buf, BUFSIZ);
|
||||
if (result < 0)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "%ld", code);
|
||||
}
|
||||
|
|
|
@ -75,7 +75,9 @@
|
|||
/*
|
||||
* Stuff for setting the sockets into non-blocking mode.
|
||||
*/
|
||||
#if defined(__POSIX_SOURCE) || defined(__EXT_POSIX1_198808)
|
||||
#if defined(__POSIX_SOURCE)\
|
||||
|| defined(__EXT_POSIX1_198808)\
|
||||
|| defined(O_NONBLOCK)
|
||||
#define NBLK_OPT O_NONBLOCK
|
||||
#else
|
||||
#define NBLK_OPT FNDELAY
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
|
||||
#import <dns_sd.h> // Apple's DNS Service Discovery
|
||||
|
||||
#import <sys/select.h>
|
||||
#import <sys/types.h>
|
||||
#import <sys/socket.h> // AF_INET / AF_INET6
|
||||
|
||||
|
|
|
@ -76,7 +76,9 @@
|
|||
/*
|
||||
* Stuff for setting the sockets into non-blocking mode.
|
||||
*/
|
||||
#if defined(__POSIX_SOURCE) || defined(__EXT_POSIX1_198808)
|
||||
#if defined(__POSIX_SOURCE)\
|
||||
|| defined(__EXT_POSIX1_198808)\
|
||||
|| defined(O_NONBLOCK)
|
||||
#define NBLK_OPT O_NONBLOCK
|
||||
#else
|
||||
#define NBLK_OPT FNDELAY
|
||||
|
|
|
@ -83,7 +83,9 @@
|
|||
/*
|
||||
* Stuff for setting the sockets into non-blocking mode.
|
||||
*/
|
||||
#if defined(__POSIX_SOURCE) || defined(__EXT_POSIX1_198808)
|
||||
#if defined(__POSIX_SOURCE)\
|
||||
|| defined(__EXT_POSIX1_198808)\
|
||||
|| defined(O_NONBLOCK)
|
||||
#define NBLK_OPT O_NONBLOCK
|
||||
#else
|
||||
#define NBLK_OPT FNDELAY
|
||||
|
|
|
@ -24,6 +24,10 @@
|
|||
$Date$ $Revision$
|
||||
*/
|
||||
|
||||
/* define to get system-v functions including inet_aton()
|
||||
*/
|
||||
#define _SVID_SOURCE 1
|
||||
|
||||
#import "common.h"
|
||||
#define EXPOSE_NSSocketPortNameServer_IVARS 1
|
||||
#import "Foundation/NSData.h"
|
||||
|
|
|
@ -56,7 +56,9 @@
|
|||
# include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#if defined(__POSIX_SOURCE) || defined(__EXT_POSIX1_198808)
|
||||
#if defined(__POSIX_SOURCE)\
|
||||
|| defined(__EXT_POSIX1_198808)\
|
||||
|| defined(O_NONBLOCK)
|
||||
#define NBLK_OPT O_NONBLOCK
|
||||
#else
|
||||
#define NBLK_OPT FNDELAY
|
||||
|
|
|
@ -4,31 +4,41 @@
|
|||
* might be from an earlier build.
|
||||
*/
|
||||
|
||||
/* disable extensions ... we want to use standard code
|
||||
#import "config.h"
|
||||
|
||||
/* Disable extensions (config.h may have turned them on) ...
|
||||
* we want to use standard code.
|
||||
*/
|
||||
#ifdef _GNU_SOURCE
|
||||
#undef _GNU_SOURCE
|
||||
#if defined(_GNU_SOURCE)
|
||||
# undef _GNU_SOURCE
|
||||
#endif
|
||||
|
||||
|
||||
/* Ensure we have _XOPEN_SOURCE turned on at the appropriate
|
||||
* level for the facilities we need.
|
||||
*
|
||||
* Minimum of 600 for string.h so we get the POSIX strerror_r() behavior
|
||||
* on systems using glibc.
|
||||
*
|
||||
* Any systems where using XOPEN causes problems can define GSXOPEN to 0
|
||||
*/
|
||||
/* This hack work around for glibc breaks FreeBSD and probably other platforms.
|
||||
*/
|
||||
#if (defined(__linux__) &&!defined(__GNU__)) || defined(__QNXNTO__)
|
||||
# if defined(_XOPEN_SOURCE)
|
||||
# if _XOPEN_SOURCE < 600
|
||||
# undef _XOPEN_SOURCE
|
||||
# define _XOPEN_SOURCE 600
|
||||
# endif
|
||||
# else
|
||||
# define _XOPEN_SOURCE 600
|
||||
# endif
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
# define GSXOPEN 0
|
||||
#else
|
||||
# define GSXOPEN 600
|
||||
#endif
|
||||
|
||||
#import "config.h"
|
||||
#if GSXOPEN > 0
|
||||
# if defined(_XOPEN_SOURCE)
|
||||
# if _XOPEN_SOURCE < GSXOPEN
|
||||
# undef _XOPEN_SOURCE
|
||||
# define _XOPEN_SOURCE GSXOPEN
|
||||
# endif
|
||||
# else
|
||||
# define _XOPEN_SOURCE GSXOPEN
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_STRING_H)
|
||||
/* For POSIX strerror_r() and others
|
||||
|
@ -36,6 +46,12 @@
|
|||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_STRINGS_H)
|
||||
/* For strcasecmp() and others
|
||||
*/
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
/* If this is included in a file in the Additions subdirectory, and we are
|
||||
|
|
Loading…
Reference in a new issue