don't return an object if there is no error

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35186 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2012-06-08 11:08:27 +00:00
parent 52e900d07c
commit ade0036037

View file

@ -100,8 +100,8 @@ strerror_r(int eno, char *buf, int len)
#endif #endif
#endif #endif
/* /* Returns an NSError instance encapsulating the last system error,
* Returns an NSError instance encapsulating the last system error. * or nil if the last system call did not result in an error.
* The user info dictionary of this object will be mutable, so that * The user info dictionary of this object will be mutable, so that
* additional information can be placed in it by higher level code. * additional information can be placed in it by higher level code.
*/ */
@ -114,6 +114,10 @@ strerror_r(int eno, char *buf, int len)
#else #else
eno = errno; eno = errno;
#endif #endif
if (0 == eno)
{
return nil;
}
return [self _systemError: eno]; return [self _systemError: eno];
} }