Commit 367e0365 authored by Guillem Jover's avatar Guillem Jover

test: Try setting and getting an environment variable after setproctitle()

parent dc8b0978
......@@ -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
......
/*
* 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment