From 367e036537109f8955221123af0569329868edf1 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Sat, 8 Jun 2013 08:15:21 +0200 Subject: [PATCH] test: Try setting and getting an environment variable after setproctitle() --- COPYING | 2 +- test/proctitle.c | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) 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 + Copyright © 2004-2006, 2008-2013 Guillem Jover 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 + * Copyright © 2012-2013 Guillem Jover * * 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; } -- 2.47.2