mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 03:25:20 +00:00
commandhelper: Remove origenv variable
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
3d42a57666
commit
2a1dc938f1
@ -60,7 +60,6 @@ static int envsort(const void *a, const void *b)
|
||||
int main(int argc, char **argv) {
|
||||
size_t i, n;
|
||||
int open_max;
|
||||
char **origenv;
|
||||
char **newenv = NULL;
|
||||
char *cwd;
|
||||
FILE *log = fopen(abs_builddir "/commandhelper.log", "w");
|
||||
@ -92,23 +91,16 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
}
|
||||
|
||||
origenv = environ;
|
||||
n = 0;
|
||||
while (*origenv != NULL) {
|
||||
n++;
|
||||
origenv++;
|
||||
for (n = 0; environ[n]; n++) {
|
||||
}
|
||||
|
||||
if (!(newenv = malloc(sizeof(*newenv) * n)))
|
||||
abort();
|
||||
|
||||
origenv = environ;
|
||||
n = i = 0;
|
||||
while (*origenv != NULL) {
|
||||
newenv[i++] = *origenv;
|
||||
n++;
|
||||
origenv++;
|
||||
for (i = 0; i < n; i++) {
|
||||
newenv[i] = environ[i];
|
||||
}
|
||||
|
||||
qsort(newenv, n, sizeof(newenv[0]), envsort);
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user