int pakfire_read_makefile(struct pakfire_parser** parser, struct pakfire* pakfire,
const char* path, struct pakfire_parser_error** error) {
- int r = 1;
+ int r;
// Fetch context
struct pakfire_ctx* ctx = pakfire_ctx(pakfire);
// Set defaults
r = pakfire_makefile_set_defaults(pakfire, *parser, path);
- if (r)
+ if (r < 0)
goto ERROR;
// Find all macros
break;
case GLOB_NOSPACE:
- errno = ENOMEM;
+ r = -ENOMEM;
goto ERROR;
case GLOB_ABORTED:
default:
ERROR(ctx, "glob() returned an unhandled error: %d\n", r);
+ r = -ENOTSUP;
goto ERROR;
}
for (unsigned int i = 0; i < globmacros.gl_pathc; i++) {
// Parse the file
r = pakfire_parser_read_file(*parser, globmacros.gl_pathv[i], error);
- if (r)
+ if (r < 0)
goto ERROR;
}
// Finally, parse the makefile
r = pakfire_parser_read_file(*parser, path, error);
- if (r) {
+ if (r < 0) {
ERROR(ctx, "Could not read makefile %s: %m\n", path);
goto ERROR;
}
// Load makefile
r = pakfire_read_makefile(&makefile, pakfire, path, &error);
- if (r) {
+ if (r < 0) {
if (error)
pakfire_parser_error_unref(error);
else