test: Try setting and getting an environment variable after setproctitle()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
diff --git a/COPYING b/COPYING
index 5bcfd38..285ed8f 100644
--- a/COPYING
+++ b/COPYING
@@ -66,7 +66,7 @@ for man/arc4random.3, man/tree.3 and man/getprogname.3.
The rest of the licenses apply to code and/or man pages.
- Copyright © 2004-2006, 2008-2012 Guillem Jover <guillem@hadrons.org>
+ Copyright © 2004-2006, 2008-2013 Guillem Jover <guillem@hadrons.org>
Copyright © 2005 Hector Garcia Alvarez
Copyright © 2005 Aurelien Jarno
Copyright © 2006 Robert Millan
diff --git a/test/proctitle.c b/test/proctitle.c
index 450f0d1..56ea863 100644
--- a/test/proctitle.c
+++ b/test/proctitle.c
@@ -1,5 +1,5 @@
/*
- * Copyright © 2012 Guillem Jover <guillem@hadrons.org>
+ * Copyright © 2012-2013 Guillem Jover <guillem@hadrons.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -35,6 +35,7 @@ main(int argc, char **argv)
{
const char newtitle_base[] = "test arg1 arg2";
char *newtitle_full;
+ char *envvar;
setproctitle("-test %s arg2", "arg1");
assert(strcmp(argv[0], newtitle_base) == 0);
@@ -44,5 +45,10 @@ main(int argc, char **argv)
assert(strcmp(argv[0], newtitle_full) == 0);
free(newtitle_full);
+ assert(setenv("LIBBSD_TEST", "test value", 1) == 0);
+ envvar = getenv("LIBBSD_TEST");
+ assert(envvar != NULL);
+ assert(strcmp(envvar, "test value") == 0);
+
return 0;
}