unsigned int i;
bool clear_env;
- i_assert(env[0] != NULL);
-
/* find the last argv or environment string. it should always be the
last string in environ, but don't rely on it. this is what openssh
does, so hopefully it's safe enough. */
if (argv[i] == last)
last = argv[i] + strlen(argv[i]) + 1;
}
- clear_env = last == env[0];
- for (i = 0; env[i] != NULL; i++) {
- if (env[i] == last)
- last = env[i] + strlen(env[i]) + 1;
+ if (env[0] == NULL)
+ clear_env = FALSE;
+ else {
+ clear_env = last == env[0];
+ for (i = 0; env[i] != NULL; i++) {
+ if (env[i] == last)
+ last = env[i] + strlen(env[i]) + 1;
+ }
}
process_title = argv[0];