diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2008-04-14 14:29:07 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2008-04-14 14:29:07 +0300 |
commit | 1eb29bc44d01192dc050fa9bc4a4b0a6a25726d1 (patch) | |
tree | 086ce1878ef1bbe2ccfe6cbb66d0c6a2cb5d0d1a /lib/psm.c | |
parent | 25f15fca9e1c25bbceee362be7016108a26eeaeb (diff) | |
download | rpm-1eb29bc44d01192dc050fa9bc4a4b0a6a25726d1.tar.gz rpm-1eb29bc44d01192dc050fa9bc4a4b0a6a25726d1.tar.bz2 rpm-1eb29bc44d01192dc050fa9bc4a4b0a6a25726d1.zip |
Move legacy prefix compat thing out of the loop
- additionally fix indentation, move block local variable def there...
Diffstat (limited to 'lib/psm.c')
-rw-r--r-- | lib/psm.c | 23 |
1 files changed, 11 insertions, 12 deletions
@@ -612,7 +612,6 @@ static rpmRC runScript(rpmpsm psm, Header h, rpmTag stag, const char * oldPrefix; char * fn = NULL; int xx; - int i; int freePrefixes = 0; FD_t scriptFd; FD_t out; @@ -789,18 +788,18 @@ static rpmRC runScript(rpmpsm psm, Header h, rpmTag stag, ipath = _free(ipath); } - if (prefixes != NULL) - for (i = 0; i < numPrefixes; i++) { - char * prefixBuf = NULL; - rasprintf(&prefixBuf, "RPM_INSTALL_PREFIX%d=%s", i, prefixes[i]); - xx = doputenv(prefixBuf); - prefixBuf = _free(prefixBuf); - + if (prefixes != NULL) { + int i; + char *buf = NULL; /* backwards compatibility */ - if (i == 0) { - rasprintf(&prefixBuf, "RPM_INSTALL_PREFIX=%s", prefixes[i]); - xx = doputenv(prefixBuf); - prefixBuf = _free(prefixBuf); + rasprintf(&buf, "RPM_INSTALL_PREFIX=%s", prefixes[0]); + xx = doputenv(buf); + buf = _free(buf); + + for (i = 0; i < numPrefixes; i++) { + rasprintf(&buf, "RPM_INSTALL_PREFIX%d=%s", i, prefixes[i]); + xx = doputenv(buf); + buf = _free(buf); } } |