]> git.draconx.ca Git - upkg.git/blobdiff - src/upkg.c
libupkg: Add signed integer unpacking to fix incorrect signedness issue.
[upkg.git] / src / upkg.c
index 82a673d100ccc6c522bd597713608ab40d3cd7fb..4a76fa2cdcbfaeb096daaf41d3f547371bd3e32d 100644 (file)
@@ -28,6 +28,7 @@
 #include "module.h"
 #include "uobject.h"
 #include "exportable.h"
+#include "loadable.h"
 
 enum {
        MODE_INFO,
@@ -161,6 +162,11 @@ static int export(struct upkg *pkg, GObject *obj, unsigned idx)
        if (u_object_deserialize(obj, f) != 0) {
                goto out;
        }
+
+       if (U_OBJECT_IS_LOADABLE(obj) && u_object_load(obj) != 0) {
+               goto out;
+       }
+
        u_object_export_name(obj, name, sizeof name);
 
        printf("exporting %s to %s\n", upkg_export_name(pkg, idx), name);
@@ -178,6 +184,10 @@ static int export(struct upkg *pkg, GObject *obj, unsigned idx)
                goto out;
        }
 
+       if (U_OBJECT_IS_LOADABLE(obj)) {
+               u_object_unload(obj);
+       }
+
 out:
        upkg_export_close(f);
        return rc;
@@ -192,6 +202,10 @@ int package_export(struct upkg *pkg)
 
        for (unsigned i = 0; i < pkg->export_count; i++) {
                class = upkg_export_class(pkg, i, &package);
+               if (!class) {
+                       fprintf(stderr, "error getting class information.\n");
+                       return EXIT_FAILURE;
+               }
 
                type = module_get_class(package, class);
                if (!type) continue;