19 lines
1.1 KiB
C
19 lines
1.1 KiB
C
/* bits/errno-return.h: Provides a convenient way of setting errno after a syscall. */
|
|
|
|
#ifndef _BITS_ERRNO_RETURN_H
|
|
#define _BITS_ERRNO_RETURN_H
|
|
|
|
#include <errno.h>
|
|
|
|
#define __errno_return(value, type) \
|
|
do { \
|
|
if (value < 0) \
|
|
{ \
|
|
errno = (int)(-value); \
|
|
return (type)-1; \
|
|
} \
|
|
return (type)value; \
|
|
} while (0)
|
|
|
|
#endif
|