avoid format string warnings

Avoid warnings like this:
file:nnn:format not a string literal and no format arguments

* qemud/qemud.c: Insert a "%s" format argument.
* qemud/remote.c: Likewise.
* src/iptables.c: Likewise.
* src/qemu_driver.c: Likewise.
* src/storage_backend.c: Likewise.
* src/storage_backend_fs.c: Likewise.
* src/storage_backend_iscsi.c Likewise.
* src/storage_backend_logical.c: Likewise.
* src/storage_conf.c: Likewise.
* src/storage_driver.c: Likewise.
This commit is contained in:
Jim Meyering
2008-02-22 16:26:13 +00:00
parent b59d9c85f1
commit b1b23f76be
11 changed files with 221 additions and 185 deletions
+39 -29
View File
@@ -245,9 +245,9 @@ static void qemudDispatchSignalEvent(int fd ATTRIBUTE_UNUSED,
switch (sigc) {
case SIGHUP:
qemudLog(QEMUD_INFO, _("Reloading configuration on SIGHUP"));
qemudLog(QEMUD_INFO, "%s", _("Reloading configuration on SIGHUP"));
if (virStateReload() < 0)
qemudLog(QEMUD_WARN, _("Error while reloading drivers"));
qemudLog(QEMUD_WARN, "%s", _("Error while reloading drivers"));
break;
case SIGINT:
@@ -274,7 +274,8 @@ static int qemudSetCloseExec(int fd) {
goto error;
return 0;
error:
qemudLog(QEMUD_ERR, _("Failed to set close-on-exec file descriptor flag"));
qemudLog(QEMUD_ERR,
"%s", _("Failed to set close-on-exec file descriptor flag"));
return -1;
}
@@ -288,7 +289,8 @@ static int qemudSetNonBlock(int fd) {
goto error;
return 0;
error:
qemudLog(QEMUD_ERR, _("Failed to set non-blocking file descriptor flag"));
qemudLog(QEMUD_ERR,
"%s", _("Failed to set non-blocking file descriptor flag"));
return -1;
}
@@ -467,7 +469,7 @@ static int qemudListenUnix(struct qemud_server *server,
if (!sock) {
qemudLog(QEMUD_ERR,
_("Failed to allocate memory for struct qemud_socket"));
"%s", _("Failed to allocate memory for struct qemud_socket"));
return -1;
}
@@ -517,7 +519,7 @@ static int qemudListenUnix(struct qemud_server *server,
POLLIN| POLLERR | POLLHUP,
qemudDispatchServerEvent,
server) < 0) {
qemudLog(QEMUD_ERR, _("Failed to add server event callback"));
qemudLog(QEMUD_ERR, "%s", _("Failed to add server event callback"));
goto cleanup;
}
@@ -647,7 +649,7 @@ remoteListenTCP (struct qemud_server *server,
POLLIN| POLLERR | POLLHUP,
qemudDispatchServerEvent,
server) < 0) {
qemudLog(QEMUD_ERR, _("Failed to add server event callback"));
qemudLog(QEMUD_ERR, "%s", _("Failed to add server event callback"));
return -1;
}
@@ -698,7 +700,7 @@ static int qemudInitPaths(struct qemud_server *server,
snprintf_error:
qemudLog(QEMUD_ERR,
_("Resulting path to long for buffer in qemudInitPaths()"));
"%s", _("Resulting path to long for buffer in qemudInitPaths()"));
return -1;
}
@@ -706,7 +708,7 @@ static struct qemud_server *qemudInitialize(int sigread) {
struct qemud_server *server;
if (!(server = calloc(1, sizeof(*server)))) {
qemudLog(QEMUD_ERR, _("Failed to allocate struct qemud_server"));
qemudLog(QEMUD_ERR, "%s", _("Failed to allocate struct qemud_server"));
return NULL;
}
@@ -935,20 +937,23 @@ remoteCheckCertificate (gnutls_session_t session)
if (status != 0) {
if (status & GNUTLS_CERT_INVALID)
qemudLog (QEMUD_ERR, _("remoteCheckCertificate: "
"the client certificate is not trusted."));
qemudLog (QEMUD_ERR, "%s",
_("remoteCheckCertificate: "
"the client certificate is not trusted."));
if (status & GNUTLS_CERT_SIGNER_NOT_FOUND)
qemudLog (QEMUD_ERR, _("remoteCheckCertificate: the client "
"certificate has unknown issuer."));
qemudLog (QEMUD_ERR, "%s",
_("remoteCheckCertificate: the client "
"certificate has unknown issuer."));
if (status & GNUTLS_CERT_REVOKED)
qemudLog (QEMUD_ERR, _("remoteCheckCertificate: "
"the client certificate has been revoked."));
qemudLog (QEMUD_ERR, "%s",
_("remoteCheckCertificate: "
"the client certificate has been revoked."));
#ifndef GNUTLS_1_0_COMPAT
if (status & GNUTLS_CERT_INSECURE_ALGORITHM)
qemudLog (QEMUD_ERR,
qemudLog (QEMUD_ERR, "%s",
_("remoteCheckCertificate: the client certificate"
" uses an insecure algorithm."));
#endif
@@ -957,13 +962,13 @@ remoteCheckCertificate (gnutls_session_t session)
}
if (gnutls_certificate_type_get (session) != GNUTLS_CRT_X509) {
qemudLog (QEMUD_ERR, _("remoteCheckCertificate: "
"certificate is not X.509"));
qemudLog (QEMUD_ERR,
"%s", _("remoteCheckCertificate: certificate is not X.509"));
return -1;
}
if (!(certs = gnutls_certificate_get_peers(session, &nCerts))) {
qemudLog (QEMUD_ERR, _("remoteCheckCertificate: no peers"));
qemudLog (QEMUD_ERR, "%s", _("remoteCheckCertificate: no peers"));
return -1;
}
@@ -973,7 +978,7 @@ remoteCheckCertificate (gnutls_session_t session)
gnutls_x509_crt_t cert;
if (gnutls_x509_crt_init (&cert) < 0) {
qemudLog (QEMUD_ERR,
qemudLog (QEMUD_ERR, "%s",
_("remoteCheckCertificate: gnutls_x509_crt_init failed"));
return -1;
}
@@ -984,15 +989,15 @@ remoteCheckCertificate (gnutls_session_t session)
}
if (gnutls_x509_crt_get_expiration_time (cert) < now) {
qemudLog (QEMUD_ERR, _("remoteCheckCertificate: "
"the client certificate has expired"));
qemudLog (QEMUD_ERR, "%s", _("remoteCheckCertificate: "
"the client certificate has expired"));
gnutls_x509_crt_deinit (cert);
return -1;
}
if (gnutls_x509_crt_get_activation_time (cert) > now) {
qemudLog (QEMUD_ERR, _("remoteCheckCertificate: the client "
"certificate is not yet activated"));
qemudLog (QEMUD_ERR, "%s", _("remoteCheckCertificate: the client "
"certificate is not yet activated"));
gnutls_x509_crt_deinit (cert);
return -1;
}
@@ -1000,7 +1005,7 @@ remoteCheckCertificate (gnutls_session_t session)
if (i == 0) {
if (!remoteCheckDN (cert)) {
/* This is the most common error: make it informative. */
qemudLog (QEMUD_ERR, _("remoteCheckCertificate: client's Distinguished Name is not on the list of allowed clients (tls_allowed_dn_list). Use 'openssl x509 -in clientcert.pem -text' to view the Distinguished Name field in the client certificate, or run this daemon with --verbose option."));
qemudLog (QEMUD_ERR, "%s", _("remoteCheckCertificate: client's Distinguished Name is not on the list of allowed clients (tls_allowed_dn_list). Use 'openssl x509 -in clientcert.pem -text' to view the Distinguished Name field in the client certificate, or run this daemon with --verbose option."));
gnutls_x509_crt_deinit (cert);
return -1;
}
@@ -1016,9 +1021,13 @@ remoteCheckAccess (struct qemud_client *client)
{
/* Verify client certificate. */
if (remoteCheckCertificate (client->tlssession) == -1) {
qemudLog (QEMUD_ERR, _("remoteCheckCertificate: failed to verify client's certificate"));
qemudLog (QEMUD_ERR, "%s",
_("remoteCheckCertificate: "
"failed to verify client's certificate"));
if (!tls_no_verify_certificate) return -1;
else qemudLog (QEMUD_INFO, _("remoteCheckCertificate: tls_no_verify_certificate is set so the bad certificate is ignored"));
else qemudLog (QEMUD_INFO, "%s",
_("remoteCheckCertificate: tls_no_verify_certificate "
"is set so the bad certificate is ignored"));
}
/* Checks have succeeded. Write a '\1' byte back to the client to
@@ -1887,7 +1896,7 @@ remoteReadConfigFile (struct qemud_server *server, const char *filename)
if (unix_sock_group) {
if (getuid() != 0) {
qemudLog (QEMUD_WARN,
_("Cannot set group when not running as root"));
"%s", _("Cannot set group when not running as root"));
} else {
struct group *grp = getgrnam(unix_sock_group);
if (!grp) {
@@ -2144,7 +2153,8 @@ int main(int argc, char **argv) {
POLLIN,
qemudDispatchSignalEvent,
server) < 0) {
qemudLog(QEMUD_ERR, _("Failed to register callback for signal pipe"));
qemudLog(QEMUD_ERR,
"%s", _("Failed to register callback for signal pipe"));
ret = 3;
goto error2;
}
+15 -13
View File
@@ -2130,7 +2130,7 @@ remoteDispatchAuthSaslInit (struct qemud_server *server ATTRIBUTE_UNUSED,
REMOTE_DEBUG("Initialize SASL auth %d", client->fd);
if (client->auth != REMOTE_AUTH_SASL ||
client->saslconn != NULL) {
qemudLog(QEMUD_ERR, _("client tried invalid SASL init request"));
qemudLog(QEMUD_ERR, "%s", _("client tried invalid SASL init request"));
remoteDispatchFailAuth(client, req);
return -2;
}
@@ -2184,7 +2184,7 @@ remoteDispatchAuthSaslInit (struct qemud_server *server ATTRIBUTE_UNUSED,
cipher = gnutls_cipher_get(client->tlssession);
if (!(ssf = (sasl_ssf_t)gnutls_cipher_get_key_size(cipher))) {
qemudLog(QEMUD_ERR, _("cannot TLS get cipher size"));
qemudLog(QEMUD_ERR, "%s", _("cannot TLS get cipher size"));
remoteDispatchFailAuth(client, req);
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
@@ -2250,7 +2250,7 @@ remoteDispatchAuthSaslInit (struct qemud_server *server ATTRIBUTE_UNUSED,
REMOTE_DEBUG("Available mechanisms for client: '%s'", mechlist);
ret->mechlist = strdup(mechlist);
if (!ret->mechlist) {
qemudLog(QEMUD_ERR, _("cannot allocate mechlist"));
qemudLog(QEMUD_ERR, "%s", _("cannot allocate mechlist"));
remoteDispatchFailAuth(client, req);
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
@@ -2323,7 +2323,7 @@ remoteSASLCheckAccess (struct qemud_server *server,
return -1;
}
if (val == NULL) {
qemudLog(QEMUD_ERR, _("no client username was found"));
qemudLog(QEMUD_ERR, "%s", _("no client username was found"));
remoteDispatchFailAuth(client, req);
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
@@ -2333,7 +2333,7 @@ remoteSASLCheckAccess (struct qemud_server *server,
client->saslUsername = strdup((const char*)val);
if (client->saslUsername == NULL) {
qemudLog(QEMUD_ERR, _("out of memory copying username"));
qemudLog(QEMUD_ERR, "%s", _("out of memory copying username"));
remoteDispatchFailAuth(client, req);
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
@@ -2378,7 +2378,7 @@ remoteDispatchAuthSaslStart (struct qemud_server *server,
REMOTE_DEBUG("Start SASL auth %d", client->fd);
if (client->auth != REMOTE_AUTH_SASL ||
client->saslconn == NULL) {
qemudLog(QEMUD_ERR, _("client tried invalid SASL start request"));
qemudLog(QEMUD_ERR, "%s", _("client tried invalid SASL start request"));
remoteDispatchFailAuth(client, req);
return -2;
}
@@ -2458,7 +2458,7 @@ remoteDispatchAuthSaslStep (struct qemud_server *server,
REMOTE_DEBUG("Step SASL auth %d", client->fd);
if (client->auth != REMOTE_AUTH_SASL ||
client->saslconn == NULL) {
qemudLog(QEMUD_ERR, _("client tried invalid SASL start request"));
qemudLog(QEMUD_ERR, "%s", _("client tried invalid SASL start request"));
remoteDispatchFailAuth(client, req);
return -2;
}
@@ -2532,7 +2532,7 @@ remoteDispatchAuthSaslInit (struct qemud_server *server ATTRIBUTE_UNUSED,
void *args ATTRIBUTE_UNUSED,
remote_auth_sasl_init_ret *ret ATTRIBUTE_UNUSED)
{
qemudLog(QEMUD_ERR, _("client tried unsupported SASL init request"));
qemudLog(QEMUD_ERR, "%s", _("client tried unsupported SASL init request"));
remoteDispatchFailAuth(client, req);
return -1;
}
@@ -2544,7 +2544,7 @@ remoteDispatchAuthSaslStart (struct qemud_server *server ATTRIBUTE_UNUSED,
remote_auth_sasl_start_args *args ATTRIBUTE_UNUSED,
remote_auth_sasl_start_ret *ret ATTRIBUTE_UNUSED)
{
qemudLog(QEMUD_ERR, _("client tried unsupported SASL start request"));
qemudLog(QEMUD_ERR, "%s", _("client tried unsupported SASL start request"));
remoteDispatchFailAuth(client, req);
return -1;
}
@@ -2556,7 +2556,7 @@ remoteDispatchAuthSaslStep (struct qemud_server *server ATTRIBUTE_UNUSED,
remote_auth_sasl_step_args *args ATTRIBUTE_UNUSED,
remote_auth_sasl_step_ret *ret ATTRIBUTE_UNUSED)
{
qemudLog(QEMUD_ERR, _("client tried unsupported SASL step request"));
qemudLog(QEMUD_ERR, "%s", _("client tried unsupported SASL step request"));
remoteDispatchFailAuth(client, req);
return -1;
}
@@ -2597,13 +2597,14 @@ remoteDispatchAuthPolkit (struct qemud_server *server ATTRIBUTE_UNUSED,
REMOTE_DEBUG("Start PolicyKit auth %d", client->fd);
if (client->auth != REMOTE_AUTH_POLKIT) {
qemudLog(QEMUD_ERR, _("client tried invalid PolicyKit init request"));
qemudLog(QEMUD_ERR,
"%s", _("client tried invalid PolicyKit init request"));
remoteDispatchFailAuth(client, req);
return -2;
}
if (qemudGetSocketIdentity(client->fd, &callerUid, &callerPid) < 0) {
qemudLog(QEMUD_ERR, _("cannot get peer socket identity"));
qemudLog(QEMUD_ERR, "%s", _("cannot get peer socket identity"));
remoteDispatchFailAuth(client, req);
return -2;
}
@@ -2713,7 +2714,8 @@ remoteDispatchAuthPolkit (struct qemud_server *server ATTRIBUTE_UNUSED,
void *args ATTRIBUTE_UNUSED,
remote_auth_polkit_ret *ret ATTRIBUTE_UNUSED)
{
qemudLog(QEMUD_ERR, _("client tried unsupported PolicyKit init request"));
qemudLog(QEMUD_ERR,
"%s", _("client tried unsupported PolicyKit init request"));
remoteDispatchFailAuth(client, req);
return -1;
}