_alpm_runscriptlet(): remove clean_tmpdir variable
This is always true at the end since we return early if we couldn't create the tmpdir, so it is totally unnecessary. Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
3796164848
commit
70e2c34f0f
1 changed files with 4 additions and 7 deletions
|
@ -280,7 +280,6 @@ int _alpm_runscriptlet(alpm_handle_t *handle, const char *installfn,
|
||||||
char tmpdir[PATH_MAX];
|
char tmpdir[PATH_MAX];
|
||||||
char *argv[] = { "sh", "-c", cmdline, NULL };
|
char *argv[] = { "sh", "-c", cmdline, NULL };
|
||||||
char *scriptpath;
|
char *scriptpath;
|
||||||
int clean_tmpdir = 0;
|
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
|
|
||||||
if(_alpm_access(handle, NULL, installfn, R_OK) != 0) {
|
if(_alpm_access(handle, NULL, installfn, R_OK) != 0) {
|
||||||
|
@ -297,8 +296,6 @@ int _alpm_runscriptlet(alpm_handle_t *handle, const char *installfn,
|
||||||
if(mkdtemp(tmpdir) == NULL) {
|
if(mkdtemp(tmpdir) == NULL) {
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR, _("could not create temp directory\n"));
|
_alpm_log(handle, ALPM_LOG_ERROR, _("could not create temp directory\n"));
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
|
||||||
clean_tmpdir = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* either extract or copy the scriptlet */
|
/* either extract or copy the scriptlet */
|
||||||
|
@ -317,14 +314,14 @@ int _alpm_runscriptlet(alpm_handle_t *handle, const char *installfn,
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* chop off the root so we can find the tmpdir in the chroot */
|
|
||||||
scriptpath = scriptfn + strlen(handle->root) - 1;
|
|
||||||
|
|
||||||
if(!grep(scriptfn, script)) {
|
if(!grep(scriptfn, script)) {
|
||||||
/* script not found in scriptlet file */
|
/* script not found in scriptlet file */
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* chop off the root so we can find the tmpdir in the chroot */
|
||||||
|
scriptpath = scriptfn + strlen(handle->root) - 1;
|
||||||
|
|
||||||
if(oldver) {
|
if(oldver) {
|
||||||
snprintf(cmdline, PATH_MAX, ". %s; %s %s %s",
|
snprintf(cmdline, PATH_MAX, ". %s; %s %s %s",
|
||||||
scriptpath, script, ver, oldver);
|
scriptpath, script, ver, oldver);
|
||||||
|
@ -338,7 +335,7 @@ int _alpm_runscriptlet(alpm_handle_t *handle, const char *installfn,
|
||||||
retval = _alpm_run_chroot(handle, "/bin/sh", argv);
|
retval = _alpm_run_chroot(handle, "/bin/sh", argv);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if(clean_tmpdir && _alpm_rmrf(tmpdir)) {
|
if(_alpm_rmrf(tmpdir)) {
|
||||||
_alpm_log(handle, ALPM_LOG_WARNING, _("could not remove tmpdir %s\n"), tmpdir);
|
_alpm_log(handle, ALPM_LOG_WARNING, _("could not remove tmpdir %s\n"), tmpdir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue