Browse Source

cmd_wrapper: fix libc support see Note

Note:
at least musl-libc and newer glibc stick to standards and consider
setenv(..., NULL, ...) UB as per
http://pubs.opengroup.org/onlinepubs/9699919799/functions/setenv.html
We choose this fix because it mimics old behaviour of glibc, but the real fix
would be to not call at all setenv with NULL second parameter.
Musl relevant mail thread:
http://www.openwall.com/lists/musl/2015/04/23/1
master
Nagy Károly Gábriel 9 years ago
parent
commit
62b35962ee
1 changed files with 9 additions and 2 deletions
  1. +9
    -2
      src/tools-source/cmd_wrapper.c

+ 9
- 2
src/tools-source/cmd_wrapper.c

@ -3,7 +3,7 @@
* This copyright note is auto-generated by ./scripts/Create-CopyPatch. * This copyright note is auto-generated by ./scripts/Create-CopyPatch.
* *
* Filename: src/tools-source/cmd_wrapper.c * Filename: src/tools-source/cmd_wrapper.c
* Copyright (C) 2013 The OpenSDE Project
* Copyright (C) 2013 - 2015 The OpenSDE Project
* Copyright (C) 2004 - 2006 The T2 SDE Project * Copyright (C) 2004 - 2006 The T2 SDE Project
* Copyright (C) 1998 - 2003 Clifford Wolf * Copyright (C) 1998 - 2003 Clifford Wolf
* *
@ -281,7 +281,14 @@ int main(int argc, char ** argv) {
} }
else { else {
other = strtok(other, ":"); other = strtok(other, ":");
setenv(ENVPREFIX "_WRAPPER_OTHERS_DONE", other, 1);
if ( other == NULL )
{
setenv(ENVPREFIX "_WRAPPER_OTHERS_DONE", "", 1);
}
else
{
setenv(ENVPREFIX "_WRAPPER_OTHERS_DONE", other, 1);
}
} }
} }

Loading…
Cancel
Save