[hackers] [sbase] Avoid double call to getenv in chroot || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Sat, 05 Oct 2013 16:29:57 +0200

commit 5e9c4d781b93a70f39a257769e0023ba4f33dd35
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
Date: Sat Jul 20 13:19:32 2013 +0200

    Avoid double call to getenv in chroot

diff --git a/chroot.c b/chroot.c
index 39a91e4..4cef49b 100644
--- a/chroot.c
+++ b/chroot.c
_AT_@ -7,10 +7,10 @@ static void usage(void);
 int
 main(int argc, char **argv)
 {
- char *shell[] = {"/bin/sh", "-i", NULL};
+ char *shell[] = {"/bin/sh", "-i", NULL}, *aux;
 
- if(getenv("SHELL"))
- shell[0] = getenv("SHELL");
+ if(aux = getenv("SHELL"))
+ shell[0] = aux;
 
         if(argc < 2)
                 usage();
Received on Sat Oct 05 2013 - 16:29:57 CEST

This archive was generated by hypermail 2.3.0 : Sat Oct 05 2013 - 16:37:10 CEST