libxbps: even if executing a pre-remove action fails, continue removing pkg.

This is no reason to stop removing a pkg, so just continue and fully
remove the pkg.
This commit is contained in:
Juan RP 2012-12-29 07:13:49 +01:00
parent 0f22579a34
commit 5d59a15faf

View File

@ -266,7 +266,7 @@ xbps_remove_pkg(struct xbps_handle *xhp,
"execute pre ACTION: %s", "execute pre ACTION: %s",
pkgver, strerror(errno)); pkgver, strerror(errno));
rv = errno; rv = errno;
goto out; goto purge;
} }
} }
/* /*
@ -349,6 +349,7 @@ purge:
*/ */
buf = xbps_xasprintf("%s/.%s.plist", xhp->metadir, pkgname); buf = xbps_xasprintf("%s/.%s.plist", xhp->metadir, pkgname);
if (remove(buf) == -1) { if (remove(buf) == -1) {
free(buf);
if (errno != ENOENT) { if (errno != ENOENT) {
xbps_set_cb_state(xhp, XBPS_STATE_REMOVE_FAIL, xbps_set_cb_state(xhp, XBPS_STATE_REMOVE_FAIL,
rv, pkgname, version, rv, pkgname, version,
@ -356,6 +357,7 @@ purge:
pkgver, strerror(errno)); pkgver, strerror(errno));
} }
} }
free(buf);
/* /*
* Unregister package from pkgdb. * Unregister package from pkgdb.
*/ */
@ -367,8 +369,6 @@ purge:
xbps_set_cb_state(xhp, XBPS_STATE_REMOVE_DONE, xbps_set_cb_state(xhp, XBPS_STATE_REMOVE_DONE,
0, pkgname, version, NULL); 0, pkgname, version, NULL);
out: out:
if (buf != NULL)
free(buf);
if (pkgname != NULL) if (pkgname != NULL)
free(pkgname); free(pkgname);