[Midnightbsd-cvs] src [12198] trunk/lib/libmport/install_primative.c: cleanup and check for null values
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sat May 25 13:40:21 EDT 2019
Revision: 12198
http://svnweb.midnightbsd.org/src/?rev=12198
Author: laffer1
Date: 2019-05-25 13:40:20 -0400 (Sat, 25 May 2019)
Log Message:
-----------
cleanup and check for null values
Modified Paths:
--------------
trunk/lib/libmport/install_primative.c
Modified: trunk/lib/libmport/install_primative.c
===================================================================
--- trunk/lib/libmport/install_primative.c 2019-05-25 17:39:54 UTC (rev 12197)
+++ trunk/lib/libmport/install_primative.c 2019-05-25 17:40:20 UTC (rev 12198)
@@ -59,8 +59,10 @@
if (prefix != NULL) {
/* override the default prefix with the given prefix */
free(pkg->prefix);
- if ((pkg->prefix = strdup(prefix)) == NULL) /* all hope is lost! bail */
+ if ((pkg->prefix = strdup(prefix)) == NULL) {
+ /* all hope is lost! bail */
RETURN_ERROR(MPORT_ERR_FATAL, "Out of memory.");
+ }
}
if ((mport_check_preconditions(mport, pkg, MPORT_PRECHECK_INSTALLED | MPORT_PRECHECK_DEPENDS |
@@ -67,9 +69,12 @@
MPORT_PRECHECK_CONFLICTS) != MPORT_OK)
||
(mport_bundle_read_install_pkg(mport, bundle, pkg) != MPORT_OK)) {
- mport_call_msg_cb(mport, "Unable to install %s-%s: %s", pkg->name, pkg->version,
- mport_err_string());
- /* TODO: WHY WAS THIS HERE mport_set_err(MPORT_OK, NULL); */
+ if (pkg->name != NULL && pkg->version != NULL)
+ mport_call_msg_cb(mport, "Unable to install %s-%s: %s", pkg->name, pkg->version,
+ mport_err_string());
+ else
+ mport_call_msg_cb(mport, "Unknown error. State is invalid.");
+
error = true;
break; /* do not keep going if we have a package failure! */
}
More information about the Midnightbsd-cvs
mailing list