2010-12-23 18:07:48 -06:00
|
|
|
#ifndef UTIL_LINUX_ENV_H
|
|
|
|
#define UTIL_LINUX_ENV_H
|
|
|
|
|
2012-06-05 08:44:12 -05:00
|
|
|
#include "c.h"
|
2016-08-16 05:35:57 -05:00
|
|
|
#include "nls.h"
|
2012-06-05 08:44:12 -05:00
|
|
|
|
2012-10-17 14:26:14 -05:00
|
|
|
extern void sanitize_env(void);
|
2010-12-23 18:07:48 -06:00
|
|
|
extern char *safe_getenv(const char *arg);
|
|
|
|
|
2016-08-16 05:35:57 -05:00
|
|
|
|
|
|
|
#ifndef XSETENV_EXIT_CODE
|
|
|
|
# define XSETENV_EXIT_CODE EXIT_FAILURE
|
|
|
|
#endif
|
|
|
|
|
2012-10-17 14:26:14 -05:00
|
|
|
static inline void xsetenv(char const *name, char const *val, int overwrite)
|
2012-06-01 07:51:18 -05:00
|
|
|
{
|
2012-10-17 14:26:14 -05:00
|
|
|
if (setenv(name, val, overwrite) != 0)
|
2016-08-16 05:35:57 -05:00
|
|
|
err(XSETENV_EXIT_CODE, _("failed to set the %s environment variable"), name);
|
2012-06-01 07:51:18 -05:00
|
|
|
}
|
|
|
|
|
2010-12-23 18:07:48 -06:00
|
|
|
#endif /* UTIL_LINUX_ENV_H */
|
2006-12-06 17:25:39 -06:00
|
|
|
|