Fix xbps_dbg_printf arguments by using __attribute__((format, printf)).
Patch provided by Michael Ghering in #148. Close #148
This commit is contained in:
parent
067687ce28
commit
42994ada07
@ -634,10 +634,10 @@ struct xbps_handle {
|
|||||||
int flags;
|
int flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
void xbps_dbg_printf(struct xbps_handle *, const char *, ...);
|
void xbps_dbg_printf(struct xbps_handle *, const char *, ...) __attribute__ ((format (printf, 2, 3)));
|
||||||
void xbps_dbg_printf_append(struct xbps_handle *, const char *, ...);
|
void xbps_dbg_printf_append(struct xbps_handle *, const char *, ...)__attribute__ ((format (printf, 2, 3)));
|
||||||
void xbps_error_printf(const char *, ...);
|
void xbps_error_printf(const char *, ...)__attribute__ ((format (printf, 1, 2)));
|
||||||
void xbps_warn_printf(const char *, ...);
|
void xbps_warn_printf(const char *, ...)__attribute__ ((format (printf, 1, 2)));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the XBPS library with the following steps:
|
* Initialize the XBPS library with the following steps:
|
||||||
|
@ -95,7 +95,8 @@ xbps_entry_install_conf_file(struct xbps_handle *xhp,
|
|||||||
version = xbps_pkg_version(pkgver);
|
version = xbps_pkg_version(pkgver);
|
||||||
assert(version);
|
assert(version);
|
||||||
xbps_dbg_printf(xhp, "%s: conf_file %s not currently "
|
xbps_dbg_printf(xhp, "%s: conf_file %s not currently "
|
||||||
"installed, renaming to %s.new-%s\n", pkgver, entry_pname, version);
|
"installed, renaming to %s.new-%s\n", pkgver,
|
||||||
|
entry_pname, entry_pname, version);
|
||||||
snprintf(buf, sizeof(buf), "%s.new-%s", entry_pname, version);
|
snprintf(buf, sizeof(buf), "%s.new-%s", entry_pname, version);
|
||||||
xbps_set_cb_state(xhp, XBPS_STATE_CONFIG_FILE,
|
xbps_set_cb_state(xhp, XBPS_STATE_CONFIG_FILE,
|
||||||
0, pkgver, "File `%s' exists, installing configuration file to `%s'.", entry_pname, buf);
|
0, pkgver, "File `%s' exists, installing configuration file to `%s'.", entry_pname, buf);
|
||||||
|
@ -279,7 +279,7 @@ unpack_archive(struct xbps_handle *xhp,
|
|||||||
if (file_exists && match_preserved_file(xhp, entry_pname)) {
|
if (file_exists && match_preserved_file(xhp, entry_pname)) {
|
||||||
archive_read_data_skip(ar);
|
archive_read_data_skip(ar);
|
||||||
xbps_dbg_printf(xhp, "[unpack] `%s' exists on disk "
|
xbps_dbg_printf(xhp, "[unpack] `%s' exists on disk "
|
||||||
"and must be preserved, skipping.\n", xhp, entry_pname);
|
"and must be preserved, skipping.\n", entry_pname);
|
||||||
xbps_set_cb_state(xhp, XBPS_STATE_UNPACK_FILE_PRESERVED, 0,
|
xbps_set_cb_state(xhp, XBPS_STATE_UNPACK_FILE_PRESERVED, 0,
|
||||||
pkgver, "%s: file `%s' won't be extracted, "
|
pkgver, "%s: file `%s' won't be extracted, "
|
||||||
"it's preserved.\n", pkgver, entry_pname);
|
"it's preserved.\n", pkgver, entry_pname);
|
||||||
@ -359,13 +359,13 @@ unpack_archive(struct xbps_handle *xhp,
|
|||||||
archive_entry_gid(entry)) != 0) {
|
archive_entry_gid(entry)) != 0) {
|
||||||
xbps_dbg_printf(xhp,
|
xbps_dbg_printf(xhp,
|
||||||
"%s: failed "
|
"%s: failed "
|
||||||
"to set uid/gid to %u:%u (%s)\n",
|
"to set uid/gid to %zu:%zu (%s)\n",
|
||||||
pkgver, archive_entry_uid(entry),
|
pkgver, archive_entry_uid(entry),
|
||||||
archive_entry_gid(entry),
|
archive_entry_gid(entry),
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
} else {
|
} else {
|
||||||
xbps_dbg_printf(xhp, "%s: entry %s changed "
|
xbps_dbg_printf(xhp, "%s: entry %s changed "
|
||||||
"uid/gid to %u:%u.\n", pkgver, entry_pname,
|
"uid/gid to %zu:%zu.\n", pkgver, entry_pname,
|
||||||
archive_entry_uid(entry),
|
archive_entry_uid(entry),
|
||||||
archive_entry_gid(entry));
|
archive_entry_gid(entry));
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ find_repo_deps(struct xbps_handle *xhp,
|
|||||||
foundvpkg = false;
|
foundvpkg = false;
|
||||||
reqpkg = xbps_string_cstring_nocopy(obj);
|
reqpkg = xbps_string_cstring_nocopy(obj);
|
||||||
if (xhp->flags & XBPS_FLAG_DEBUG) {
|
if (xhp->flags & XBPS_FLAG_DEBUG) {
|
||||||
xbps_dbg_printf(xhp, "");
|
xbps_dbg_printf(xhp, "%s", "");
|
||||||
for (unsigned short x = 0; x < *depth; x++) {
|
for (unsigned short x = 0; x < *depth; x++) {
|
||||||
xbps_dbg_printf_append(xhp, " ");
|
xbps_dbg_printf_append(xhp, " ");
|
||||||
}
|
}
|
||||||
@ -299,7 +299,7 @@ find_repo_deps(struct xbps_handle *xhp,
|
|||||||
}
|
}
|
||||||
rv = add_missing_reqdep(xhp, reqpkg);
|
rv = add_missing_reqdep(xhp, reqpkg);
|
||||||
if (rv != 0 && rv != EEXIST) {
|
if (rv != 0 && rv != EEXIST) {
|
||||||
xbps_dbg_printf(xhp, "`%s': add_missing_reqdep failed %s\n", reqpkg);
|
xbps_dbg_printf(xhp, "`%s': add_missing_reqdep failed\n", reqpkg);
|
||||||
break;
|
break;
|
||||||
} else if (rv == EEXIST) {
|
} else if (rv == EEXIST) {
|
||||||
xbps_dbg_printf(xhp, "`%s' missing dep already added.\n", reqpkg);
|
xbps_dbg_printf(xhp, "`%s' missing dep already added.\n", reqpkg);
|
||||||
@ -345,7 +345,7 @@ find_repo_deps(struct xbps_handle *xhp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (xhp->flags & XBPS_FLAG_DEBUG) {
|
if (xhp->flags & XBPS_FLAG_DEBUG) {
|
||||||
xbps_dbg_printf(xhp, "");
|
xbps_dbg_printf(xhp, "%s", "");
|
||||||
for (unsigned short x = 0; x < *depth; x++) {
|
for (unsigned short x = 0; x < *depth; x++) {
|
||||||
xbps_dbg_printf_append(xhp, " ");
|
xbps_dbg_printf_append(xhp, " ");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user