FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 09-19-2011, 08:13 PM
Dan McGee
 
Default _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>
---
lib/libalpm/trans.c | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index a4716b8..a5fa95b 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -280,7 +280,6 @@ int _alpm_runscriptlet(alpm_handle_t *handle, const char *installfn,
char tmpdir[PATH_MAX];
char *argv[] = { "sh", "-c", cmdline, NULL };
char *scriptpath;
- int clean_tmpdir = 0;
int retval = 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) {
_alpm_log(handle, ALPM_LOG_ERROR, _("could not create temp directory
"));
return 1;
- } else {
- clean_tmpdir = 1;
}

/* either extract or copy the scriptlet */
@@ -317,14 +314,14 @@ int _alpm_runscriptlet(alpm_handle_t *handle, const char *installfn,
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)) {
/* script not found in scriptlet file */
goto cleanup;
}

+ /* chop off the root so we can find the tmpdir in the chroot */
+ scriptpath = scriptfn + strlen(handle->root) - 1;
+
if(oldver) {
snprintf(cmdline, PATH_MAX, ". %s; %s %s %s",
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);

cleanup:
- if(clean_tmpdir && _alpm_rmrf(tmpdir)) {
+ if(_alpm_rmrf(tmpdir)) {
_alpm_log(handle, ALPM_LOG_WARNING, _("could not remove tmpdir %s
"), tmpdir);
}

--
1.7.6.1
 

Thread Tools




All times are GMT. The time now is 12:43 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org