clearenv.c 249 B

1234567891011121314
  1. #define _GNU_SOURCE
  2. #include <stdlib.h>
  3. #include <unistd.h>
  4. static void dummy(char *old, char *new) {}
  5. weak_alias(dummy, __env_rm_add);
  6. int clearenv()
  7. {
  8. char **e = __environ;
  9. __environ = 0;
  10. if (e) while (*e) __env_rm_add(*e++, 0);
  11. return 0;
  12. }