haiku/headers/private/shared/syscall_utils.h
Ingo Weinhold 7e8cb518e9 Finally decided to put the often copied RETURN_AND_SET_ERRNO() macro
into a header. This version instantiates the given argument only once.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24900 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-11 03:23:51 +00:00

19 lines
421 B
C

/*
* Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#ifndef _SYSCALL_UTILS_H
#define _SYSCALL_UTILS_H
#define RETURN_AND_SET_ERRNO(err) \
do { \
__typeof(err) raseResult = (err); \
if (raseResult < 0) { \
errno = raseResult; \
return -1; \
} \
return raseResult; \
} while (false)
#endif // _SYSCALL_UTILS_H