lib/package_unpack.c: no need to use a var just to check lstat() rval.

This commit is contained in:
Juan RP 2013-03-11 14:06:47 +01:00
parent 430b224f58
commit 5efa1de8d5

View File

@ -99,7 +99,7 @@ unpack_archive(struct xbps_handle *xhp,
ssize_t entry_size; ssize_t entry_size;
const char *file, *entry_pname, *transact, *tgtlnk; const char *file, *entry_pname, *transact, *tgtlnk;
char *pkgname, *dname, *buf, *buf2, *p, *p2; char *pkgname, *dname, *buf, *buf2, *p, *p2;
int ar_rv, rv, rv_stat, flags; int ar_rv, rv, flags;
bool preserve, update, conf_file, file_exists, skip_obsoletes; bool preserve, update, conf_file, file_exists, skip_obsoletes;
bool softreplace, skip_extract, force; bool softreplace, skip_extract, force;
uid_t euid; uid_t euid;
@ -288,8 +288,7 @@ unpack_archive(struct xbps_handle *xhp,
* Otherwise skip extracting it. * Otherwise skip extracting it.
*/ */
conf_file = skip_extract = file_exists = false; conf_file = skip_extract = file_exists = false;
rv_stat = lstat(entry_pname, &st); if (lstat(entry_pname, &st) == 0)
if (rv_stat == 0)
file_exists = true; file_exists = true;
if (!force && S_ISREG(entry_statp->st_mode)) { if (!force && S_ISREG(entry_statp->st_mode)) {
@ -480,7 +479,6 @@ unpack_archive(struct xbps_handle *xhp,
* - Package with "preserve" keyword. * - Package with "preserve" keyword.
* - Package with "skip-obsoletes" keyword. * - Package with "skip-obsoletes" keyword.
*/ */
if (skip_obsoletes || preserve || (!softreplace && !update)) if (skip_obsoletes || preserve || (!softreplace && !update))
goto out1; goto out1;
/* /*