int cli_dump_repolist(struct pakfire_repolist* list, int flags) {
struct pakfire_repo* repo = NULL;
- const char* fmt = " %-20s %8s %12d %12d \n";
int r;
if (!list)
if (!repo)
break;
- r = printf(fmt,
+ r = printf(" %-20s %8s %12d %12d \n",
pakfire_repo_get_name(repo),
pakfire_repo_get_enabled(repo) ? "Yes" : "No",
pakfire_repo_get_priority(repo),
return NULL;
// Format the time
- r = asprintf(&widget->buffer, "%02lu:%02lu", t / 60, t % 60);
+ r = asprintf(&widget->buffer, "%02ld:%02ld", t / 60, t % 60);
if (r)
return NULL;
// Otherwise show the ETA
} else {
- r = asprintf(&widget->buffer, "%-5s: %02lu:%02lu", _("ETA"), t / 60, t % 60);
+ r = asprintf(&widget->buffer, "%-5s: %02ld:%02ld", _("ETA"), t / 60, t % 60);
if (r < 0)
return NULL;
}
(*num_solutions)++;
// Show the solution
- printf(" [%d] %s\n", *num_solutions, pakfire_solution_to_string(*s));
+ printf(" [%u] %s\n", *num_solutions, pakfire_solution_to_string(*s));
}
}
// Break on anything else
default:
ERROR(archive->pakfire, "This version of Pakfire does not support "
- "archive format %d\n", archive->format);
+ "archive format %u\n", archive->format);
return -ENOTSUP;
}
- DEBUG(archive->pakfire, "Archive format is %d\n", archive->format);
+ DEBUG(archive->pakfire, "Archive format is %u\n", archive->format);
return 0;
}
// Copy everything
ssize_t bytes_written = sendfile(fileno(f), fileno(archive->f), NULL, size);
if (bytes_written < size) {
- ERROR(archive->pakfire, "Could not copy archive (%zu byte(s) written): %m\n",
+ ERROR(archive->pakfire, "Could not copy archive (%zd byte(s) written): %m\n",
bytes_written);
goto ERROR;
}
// Fetch the next file
file = pakfire_filelist_get(ctx->filelist, ctx->i);
if (!file) {
- DEBUG(pakfire, "Could not fetch file %d: %m\n", ctx->i);
+ DEBUG(pakfire, "Could not fetch file %u: %m\n", ctx->i);
r = 1;
goto ERROR;
}
for (char** package = packages; *package; package++)
num_packages++;
- DEBUG(build->pakfire, "Found %d package(s)\n", num_packages);
+ DEBUG(build->pakfire, "Found %u package(s)\n", num_packages);
// Build packages in reverse order
for (int i = num_packages - 1; i >= 0; i--) {
// unprivileged users
default:
r = pakfire_string_format(cgroup->root,
- "/sys/fs/cgroup/user.slice/user-%d.slice/user@%d.service", uid, uid);
+ "/sys/fs/cgroup/user.slice/user-%u.slice/user@%u.service", uid, uid);
break;
}
}
}
- DEBUG(cgroup->pakfire, "Unknown key for CPU stats: %s = %ld\n", key, val);
+ DEBUG(cgroup->pakfire, "Unknown key for CPU stats: %s = %lu\n", key, val);
return 0;
}
}
// Log any unknown keys
- DEBUG(cgroup->pakfire, "Unknown key for memory stats: %s = %ld\n", key, val);
+ DEBUG(cgroup->pakfire, "Unknown key for memory stats: %s = %lu\n", key, val);
return 0;
}
break;
default:
- ERROR(downloader->pakfire, "Received unhandled cURL message %d\n", msg->msg);
+ ERROR(downloader->pakfire, "Received unhandled cURL message %u\n", msg->msg);
break;
}
}
if (cap_permitted) {
r = cap_set_flag(file->caps, CAP_PERMITTED, 1, caps, CAP_SET);
if (r) {
- ERROR(file->pakfire, "Could not set capability %d: %m\n", cap);
+ ERROR(file->pakfire, "Could not set capability %u: %m\n", cap);
goto ERROR;
}
}
if (cap_inheritable) {
r = cap_set_flag(file->caps, CAP_INHERITABLE, 1, caps, CAP_SET);
if (r) {
- ERROR(file->pakfire, "Could not set capability %d: %m\n", cap);
+ ERROR(file->pakfire, "Could not set capability %u: %m\n", cap);
goto ERROR;
}
}
if (cap_effective) {
r = cap_set_flag(file->caps, CAP_EFFECTIVE, 1, caps, CAP_SET);
if (r) {
- ERROR(file->pakfire, "Could not set capability %d: %m\n", cap);
+ ERROR(file->pakfire, "Could not set capability %u: %m\n", cap);
goto ERROR;
}
}
// Fetch CAP_PERMITTED
r = cap_get_flag(file->caps, cap, CAP_PERMITTED, &cap_permitted);
if (r) {
- ERROR(file->pakfire, "Could not fetch capability %d: %m\n", cap);
+ ERROR(file->pakfire, "Could not fetch capability %u: %m\n", cap);
goto ERROR;
}
// Fetch CAP_INHERITABLE
r = cap_get_flag(file->caps, cap, CAP_INHERITABLE, &cap_inheritable);
if (r) {
- ERROR(file->pakfire, "Could not fetch capability %d: %m\n", cap);
+ ERROR(file->pakfire, "Could not fetch capability %u: %m\n", cap);
goto ERROR;
}
// Fetch CAP_EFFECTIVE
r = cap_get_flag(file->caps, cap, CAP_EFFECTIVE, &cap_effective);
if (r) {
- ERROR(file->pakfire, "Could not fetch capability %d: %m\n", cap);
+ ERROR(file->pakfire, "Could not fetch capability %u: %m\n", cap);
goto ERROR;
}
// Size differs
file->verify_status |= PAKFIRE_FILE_SIZE_CHANGED;
- DEBUG(file->pakfire, "%s: Filesize differs (expected %zu, got %zu byte(s))\n",
+ DEBUG(file->pakfire, "%s: Filesize differs (expected %zd, got %zd byte(s))\n",
pakfire_file_get_path(file), size, st->st_size);
return 0;
jail->timeout.it_value.tv_sec = timeout;
if (timeout > 0)
- DEBUG(jail->pakfire, "Timeout set to %d second(s)\n", timeout);
+ DEBUG(jail->pakfire, "Timeout set to %u second(s)\n", timeout);
else
DEBUG(jail->pakfire, "Timeout disabled\n");
goto ERROR;
}
- DEBUG(jail->pakfire, "Received signal %d\n", siginfo.ssi_signo);
+ DEBUG(jail->pakfire, "Received signal %u\n", siginfo.ssi_signo);
// Handle signals
switch (siginfo.ssi_signo) {
break;
default:
- ERROR(jail->pakfire, "Received unhandled signal %d\n",
+ ERROR(jail->pakfire, "Received unhandled signal %u\n",
siginfo.ssi_signo);
break;
}
uid_t euid = geteuid();
gid_t egid = getegid();
- DEBUG(jail->pakfire, " UID: %d (effective %d)\n", uid, euid);
- DEBUG(jail->pakfire, " GID: %d (effective %d)\n", gid, egid);
+ DEBUG(jail->pakfire, " UID: %u (effective %u)\n", uid, euid);
+ DEBUG(jail->pakfire, " GID: %u (effective %u)\n", gid, egid);
// Check if we are (effectively running as root)
if (uid || gid || euid || egid) {
// Log argv
for (unsigned int i = 0; argv[i]; i++)
- DEBUG(jail->pakfire, " argv[%d] = %s\n", i, argv[i]);
+ DEBUG(jail->pakfire, " argv[%u] = %s\n", i, argv[i]);
// exec() command
r = execvpe(argv[0], (char**)argv, jail->env);
break;
default:
- ERROR(pakfire, "Unsupported key algorithm %d\n", algo);
+ ERROR(pakfire, "Unsupported key algorithm %u\n", algo);
errno = ENOTSUP;
goto ERROR;
}
break;
default:
- ERROR(pakfire, "Invalid key algorithm %d\n", algo);
+ ERROR(pakfire, "Invalid key algorithm %u\n", algo);
errno = EINVAL;
return 1;
}
// Check if the ID is in range
if (unmapped_id < 0) {
- ERROR(pakfire, "Mapped ID is out of range. Setting to %d\n", subid->id);
+ ERROR(pakfire, "Mapped ID is out of range. Setting to %u\n", subid->id);
unmapped_id = subid->id;
}
goto ERROR;
DEBUG(p, "Pakfire initialized at %p\n", p);
- DEBUG(p, " user = %s (%d)\n", p->user.name, p->user.uid);
- DEBUG(p, " group = %s (%d)\n", p->group.name, p->group.gid);
+ DEBUG(p, " user = %s (%u)\n", p->user.name, p->user.uid);
+ DEBUG(p, " group = %s (%u)\n", p->group.name, p->group.gid);
DEBUG(p, " arch = %s (%s)\n", pakfire_get_arch(p), pakfire_get_effective_arch(p));
DEBUG(p, " path = %s\n", pakfire_get_path(p));
if (p->user.subuids.id)
- DEBUG(p, " subuid = %d (%zu)\n", p->user.subuids.id, p->user.subuids.length);
+ DEBUG(p, " subuid = %u (%zu)\n", p->user.subuids.id, p->user.subuids.length);
if (p->group.subgids.id)
- DEBUG(p, " subgid = %d (%zu)\n", p->group.subgids.id, p->group.subgids.length);
+ DEBUG(p, " subgid = %u (%zu)\n", p->group.subgids.id, p->group.subgids.length);
// Perform some safety checks
r = pakfire_safety_checks(p);
return pakfire_map_id(pakfire, &pakfire->user.subuids, 0);
}
- DEBUG(pakfire, "Mapping %s to UID %d\n", name, entry->pw_uid);
+ DEBUG(pakfire, "Mapping %s to UID %u\n", name, entry->pw_uid);
return pakfire_map_id(pakfire, &pakfire->user.subuids, entry->pw_uid);
}
return pakfire_map_id(pakfire, &pakfire->group.subgids, 0);
}
- DEBUG(pakfire, "Mapping %s to GID %d\n", name, entry->gr_gid);
+ DEBUG(pakfire, "Mapping %s to GID %u\n", name, entry->gr_gid);
return pakfire_map_id(pakfire, &pakfire->group.subgids, entry->gr_gid);
}
// Import flags
d->flags = flags;
- DEBUG(parser->pakfire, "%p: New declaration (%d): %s.%s %s= %s\n",
+ DEBUG(parser->pakfire, "%p: New declaration (%u): %s.%s %s= %s\n",
parser,
d->flags,
d->namespace,
struct pakfire_parser* parent, struct pakfire_parser_error** error, const char* s) {
const struct pakfire_parser_state* state = yyget_extra(scanner);
- ERROR(pakfire, "Error (line %d): %s\n", state->lineno, s);
+ ERROR(pakfire, "Error (line %u): %s\n", state->lineno, s);
// Create a new error object
if (error) {
free(line);
if (!r)
- DEBUG(pakfire, "Parsed SUBID entry: name=%s, id=%d, length=%zu\n",
+ DEBUG(pakfire, "Parsed SUBID entry: name=%s, id=%u, length=%zu\n",
subid->name, subid->id, subid->length);
return r;
return PAKFIRE_STEP_DOWNGRADED;
default:
- ERROR(transaction->pakfire, "Unhandled step type 0x%x. Ignoring.\n", type);
+ ERROR(transaction->pakfire, "Unhandled step type 0x%x. Ignoring.\n",
+ (unsigned int)type);
return PAKFIRE_STEP_UNKNOWN;
}
}
return -errno;
// Append the string to the buffer
- r = asprintf(buffer, "%s* %s\n", *buffer, s);
+ r = asprintf(buffer, "%s* %s\n", (*buffer) ? *buffer : "", s);
if (r < 0)
return -errno;
}
if (r)
- ERROR(transaction->pakfire, "Step %s (%d) for %s has failed: %m\n",
+ ERROR(transaction->pakfire, "Step %s (%u) for %s has failed: %m\n",
pakfire_action_type_string(action), type, nevra);
return r;
// End loop if action was unsuccessful
if (r) {
- DEBUG(transaction->pakfire, "Step %d failed: %m\n", i);
+ DEBUG(transaction->pakfire, "Step %u failed: %m\n", i);
break;
}
}