// Copy the dependency to the stack (and remove the trailing newline)
r = pakfire_string_format(dep, "%.*s", (int)length - 1, buffer);
- if (r)
+ if (r < 0)
return r;
DEBUG(ctx, "Processing dependency: %s\n", dep);
r = pcre2_get_error_message(r, (PCRE2_UCHAR*)error, sizeof(error));
if (r < 0) {
ERROR(ctx, "Could not fetch PCRE error message: %m\n");
- r = 1;
+ r = -errno;
goto ERROR;
}
ERROR(ctx, "Could not match the filter: %s\n", error);
- r = 1;
+ r = -errno;
goto ERROR;
// Match!
} else {
DEBUG(ctx, "Skipping dependency that has been filtered: %s\n", dep);
- r = 0;
- goto ERROR;
+ goto SKIP;
}
}
// Add dependency
- r = pakfire_package_add_dep(p->pkg, p->dep, buffer);
- if (r) {
- ERROR(ctx, "Could not process dependency '%s': %m\n", buffer);
- return r;
+ r = pakfire_package_add_dep(p->pkg, p->dep, dep);
+ if (r < 0) {
+ ERROR(ctx, "Could not process dependency '%s': %s\n", dep, strerror(-r));
+ goto ERROR;
}
+ // We have consumed the entire buffer
+ r = length;
+
goto ERROR;
SKIP: