Fix setenv(3) error case.

This commit is contained in:
Jonas 'Sortie' Termansen 2014-09-14 23:48:30 +02:00
parent 513c5f242d
commit 87fee95949
1 changed files with 5 additions and 2 deletions

View File

@ -177,6 +177,9 @@ extern "C" int setenv(const char* name, const char* value, int overwrite)
}
// Append the new entry to the environ array.
bool result = set_entry_at(environ, __environ_used++, name, name_length, value, value_length);
return result ? 0 : -1;
if ( !set_entry_at(environ, __environ_used,
name, name_length,
value, value_length) )
return -1;
return __environ_used++, 0;
}