[libvirt PATCH 18/51] logging: Update format strings in translated messages

Jiri Denemark jdenemar at redhat.com
Fri Mar 10 16:09:34 UTC 2023


Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
---
 src/logging/log_cleaner.c         |  2 +-
 src/logging/log_daemon.c          | 26 +++++++++++++-------------
 src/logging/log_daemon_dispatch.c |  2 +-
 src/logging/log_handler.c         |  4 ++--
 4 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/src/logging/log_cleaner.c b/src/logging/log_cleaner.c
index 38f818f177..4ee91843aa 100644
--- a/src/logging/log_cleaner.c
+++ b/src/logging/log_cleaner.c
@@ -87,7 +87,7 @@ virLogCleanerParseFilename(const char *path,
 
     if (virStrToLong_i(rotated_index_str, NULL, 10, rotated_index) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Failed to parse rotated index from '%s'"),
+                       _("Failed to parse rotated index from '%1$s'"),
                        rotated_index_str);
         return NULL;
     }
diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c
index b4db585810..daf7ef4b2f 100644
--- a/src/logging/log_daemon.c
+++ b/src/logging/log_daemon.c
@@ -190,7 +190,7 @@ virLogDaemonNewServerPostExecRestart(virNetDaemon *dmn,
                                               dmn);
     } else {
         virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Unexpected server name '%s' during restart"),
+                       _("Unexpected server name '%1$s' during restart"),
                        name);
         return NULL;
     }
@@ -336,14 +336,14 @@ virLogDaemonClientNew(virNetServerClient *client,
 
     if (!privileged) {
         if (geteuid() != clientuid) {
-            virReportRestrictedError(_("Disallowing client %llu with uid %llu"),
+            virReportRestrictedError(_("Disallowing client %1$llu with uid %2$llu"),
                                      (unsigned long long)priv->clientPid,
                                      (unsigned long long)clientuid);
             goto error;
         }
     } else {
         if (clientuid != 0) {
-            virReportRestrictedError(_("Disallowing client %llu with uid %llu"),
+            virReportRestrictedError(_("Disallowing client %1$llu with uid %2$llu"),
                                      (unsigned long long)priv->clientPid,
                                      (unsigned long long)clientuid);
             goto error;
@@ -518,7 +518,7 @@ virLogDaemonPreExecRestart(const char *state_file,
 
     if (virFileWriteStr(state_file, state, 0700) < 0) {
         virReportSystemError(errno,
-                             _("Unable to save state file %s"), state_file);
+                             _("Unable to save state file %1$s"), state_file);
         return -1;
     }
 
@@ -540,7 +540,7 @@ virLogDaemonUsage(const char *argv0, bool privileged)
     fprintf(stderr,
             _("\n"
               "Usage:\n"
-              "  %s [options]\n"
+              "  %1$s [options]\n"
               "\n"
               "Options:\n"
               "  -h | --help            Display program help:\n"
@@ -559,13 +559,13 @@ virLogDaemonUsage(const char *argv0, bool privileged)
                   "  Default paths:\n"
                   "\n"
                   "    Configuration file (unless overridden by -f):\n"
-                  "      %s/libvirt/virtlogd.conf\n"
+                  "      %1$s/libvirt/virtlogd.conf\n"
                   "\n"
                   "    Sockets:\n"
-                  "      %s/libvirt/virtlogd-sock\n"
+                  "      %2$s/libvirt/virtlogd-sock\n"
                   "\n"
                   "    PID file (unless overridden by -p):\n"
-                  "      %s/virtlogd.pid\n"
+                  "      %3$s/virtlogd.pid\n"
                   "\n"),
                 SYSCONFDIR,
                 RUNSTATEDIR,
@@ -625,7 +625,7 @@ int main(int argc, char **argv) {
 
     if (virGettextInitialize() < 0 ||
         virErrorInitialize() < 0) {
-        fprintf(stderr, _("%s: initialization failed\n"), argv[0]);
+        fprintf(stderr, _("%1$s: initialization failed\n"), argv[0]);
         exit(EXIT_FAILURE);
     }
 
@@ -705,7 +705,7 @@ int main(int argc, char **argv) {
     /* Read the config file if it exists */
     if (remote_config_file &&
         virLogDaemonConfigLoadFile(config, remote_config_file, implicit_conf) < 0) {
-        VIR_ERROR(_("Can't load config file: %s: %s"),
+        VIR_ERROR(_("Can't load config file: %1$s: %2$s"),
                   virGetLastErrorMessage(), remote_config_file);
         exit(EXIT_FAILURE);
     }
@@ -764,7 +764,7 @@ int main(int argc, char **argv) {
         old_umask = umask(077);
     VIR_DEBUG("Ensuring run dir '%s' exists", run_dir);
     if (g_mkdir_with_parents(run_dir, 0777) < 0) {
-        VIR_ERROR(_("unable to create rundir %s: %s"), run_dir,
+        VIR_ERROR(_("unable to create rundir %1$s: %2$s"), run_dir,
                   g_strerror(errno));
         ret = VIR_DAEMON_ERR_RUNDIR;
         umask(old_umask);
@@ -790,13 +790,13 @@ int main(int argc, char **argv) {
 
         if (godaemon) {
             if (chdir("/") < 0) {
-                VIR_ERROR(_("cannot change to root directory: %s"),
+                VIR_ERROR(_("cannot change to root directory: %1$s"),
                           g_strerror(errno));
                 goto cleanup;
             }
 
             if ((statuswrite = virDaemonForkIntoBackground(argv[0])) < 0) {
-                VIR_ERROR(_("Failed to fork as daemon: %s"),
+                VIR_ERROR(_("Failed to fork as daemon: %1$s"),
                           g_strerror(errno));
                 goto cleanup;
             }
diff --git a/src/logging/log_daemon_dispatch.c b/src/logging/log_daemon_dispatch.c
index f7448155fc..f1c8163cca 100644
--- a/src/logging/log_daemon_dispatch.c
+++ b/src/logging/log_daemon_dispatch.c
@@ -117,7 +117,7 @@ virLogManagerProtocolDispatchDomainReadLogFile(virNetServer *server G_GNUC_UNUSE
 
     if (args->maxlen > VIR_LOG_MANAGER_PROTOCOL_STRING_MAX) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Requested data len %llu is larger than maximum %d"),
+                       _("Requested data len %1$llu is larger than maximum %2$d"),
                        (unsigned long long)args->maxlen,
                        VIR_LOG_MANAGER_PROTOCOL_STRING_MAX);
         goto cleanup;
diff --git a/src/logging/log_handler.c b/src/logging/log_handler.c
index a739211c7c..71517bbbe5 100644
--- a/src/logging/log_handler.c
+++ b/src/logging/log_handler.c
@@ -354,7 +354,7 @@ virLogHandlerDomainOpenLogFile(virLogHandler *handler,
         if (STREQ(virRotatingFileWriterGetPath(handler->files[i]->file),
                   path)) {
             virReportSystemError(EBUSY,
-                                 _("Cannot open log file: '%s'"),
+                                 _("Cannot open log file: '%1$s'"),
                                  path);
             goto error;
         }
@@ -471,7 +471,7 @@ virLogHandlerDomainGetLogFilePosition(virLogHandler *handler,
 
     if (!file) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("No open log file %s"),
+                       _("No open log file %1$s"),
                        path);
         goto cleanup;
     }
-- 
2.39.2



More information about the libvir-list mailing list