mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06: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) {
|
int main(int argc, char **argv) {
|
||||||
size_t i, n;
|
size_t i, n;
|
||||||
int open_max;
|
int open_max;
|
||||||
char **origenv;
|
|
||||||
char **newenv = NULL;
|
char **newenv = NULL;
|
||||||
char *cwd;
|
char *cwd;
|
||||||
FILE *log = fopen(abs_builddir "/commandhelper.log", "w");
|
FILE *log = fopen(abs_builddir "/commandhelper.log", "w");
|
||||||
@ -92,23 +91,16 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
origenv = environ;
|
for (n = 0; environ[n]; n++) {
|
||||||
n = 0;
|
|
||||||
while (*origenv != NULL) {
|
|
||||||
n++;
|
|
||||||
origenv++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(newenv = malloc(sizeof(*newenv) * n)))
|
if (!(newenv = malloc(sizeof(*newenv) * n)))
|
||||||
abort();
|
abort();
|
||||||
|
|
||||||
origenv = environ;
|
for (i = 0; i < n; i++) {
|
||||||
n = i = 0;
|
newenv[i] = environ[i];
|
||||||
while (*origenv != NULL) {
|
|
||||||
newenv[i++] = *origenv;
|
|
||||||
n++;
|
|
||||||
origenv++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qsort(newenv, n, sizeof(newenv[0]), envsort);
|
qsort(newenv, n, sizeof(newenv[0]), envsort);
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user