diff --git a/Makefile.crtools b/Makefile.crtools index 7f21d25ff..9156fe55d 100644 --- a/Makefile.crtools +++ b/Makefile.crtools @@ -69,6 +69,7 @@ endif obj-y += cr-service.o obj-y += sd-daemon.o obj-y += plugin.o +obj-y += cr-errno.o ifneq ($(MAKECMDGOALS),clean) incdeps := y diff --git a/cr-errno.c b/cr-errno.c new file mode 100644 index 000000000..b62bb545a --- /dev/null +++ b/cr-errno.c @@ -0,0 +1,12 @@ +static int cr_errno; + +int get_cr_errno(void) +{ + return cr_errno; +} + +void set_cr_errno(int new_err) +{ + if (!cr_errno) + cr_errno = new_err; +} diff --git a/include/cr-errno.h b/include/cr-errno.h new file mode 100644 index 000000000..ccea5cd15 --- /dev/null +++ b/include/cr-errno.h @@ -0,0 +1,7 @@ +#ifndef __CR_ERRNO_H__ +#define __CR_ERRNO_H__ + +void set_cr_errno(int err); +int get_cr_errno(void); + +#endif /* __CR_ERRNO_H__ */