diff --git a/src/util/iohelper.c b/src/util/iohelper.c index dd77bda723..0a57672bb4 100644 --- a/src/util/iohelper.c +++ b/src/util/iohelper.c @@ -44,9 +44,9 @@ G_GNUC_NORETURN static void usage(int status) { if (status) { - fprintf(stderr, _("%s: try --help for more details"), program_name); + fprintf(stderr, _("%1$s: try --help for more details"), program_name); } else { - printf(_("Usage: %s FILENAME FD"), program_name); + printf(_("Usage: %1$s FILENAME FD"), program_name); } exit(status); } @@ -61,7 +61,7 @@ main(int argc, char **argv) if (virGettextInitialize() < 0 || virErrorInitialize() < 0) { - fprintf(stderr, _("%s: initialization failed"), program_name); + fprintf(stderr, _("%1$s: initialization failed"), program_name); exit(EXIT_FAILURE); } @@ -71,7 +71,7 @@ main(int argc, char **argv) usage(EXIT_SUCCESS); if (argc == 3) { /* FILENAME FD */ if (virStrToLong_i(argv[2], NULL, 10, &fd) < 0) { - fprintf(stderr, _("%s: malformed fd %s"), + fprintf(stderr, _("%1$s: malformed fd %2$s"), program_name, argv[3]); exit(EXIT_FAILURE); } @@ -85,7 +85,7 @@ main(int argc, char **argv) return 0; error: - fprintf(stderr, _("%s: failure with %s: %s"), + fprintf(stderr, _("%1$s: failure with %2$s: %3$s"), program_name, path, virGetLastErrorMessage()); exit(EXIT_FAILURE); } diff --git a/src/util/viralloc.c b/src/util/viralloc.c index 4ebbf1cf8c..7aa14cccb2 100644 --- a/src/util/viralloc.c +++ b/src/util/viralloc.c @@ -248,7 +248,7 @@ virInsertElementsN(void *ptrptr, at = *countptr; } else if (at > *countptr) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("out of bounds index - count %zu at %zu"), + _("out of bounds index - count %1$zu at %2$zu"), *countptr, at); return -1; } diff --git a/src/util/virauth.c b/src/util/virauth.c index 7b4a1bd8a5..d6917bde9f 100644 --- a/src/util/virauth.c +++ b/src/util/virauth.c @@ -153,10 +153,10 @@ virAuthGetUsernamePath(const char *path, memset(&cred, 0, sizeof(virConnectCredential)); if (defaultUsername != NULL) { - prompt = g_strdup_printf(_("Enter username for %s [%s]"), hostname, + prompt = g_strdup_printf(_("Enter username for %1$s [%2$s]"), hostname, defaultUsername); } else { - prompt = g_strdup_printf(_("Enter username for %s"), hostname); + prompt = g_strdup_printf(_("Enter username for %1$s"), hostname); } for (ncred = 0; ncred < auth->ncredtype; ncred++) { @@ -230,7 +230,7 @@ virAuthGetPasswordPath(const char *path, return NULL; } - prompt = g_strdup_printf(_("Enter %s's password for %s"), username, hostname); + prompt = g_strdup_printf(_("Enter %1$s's password for %2$s"), username, hostname); if (!(cred = virAuthAskCredential(auth, prompt, false))) return NULL; diff --git a/src/util/virauthconfig.c b/src/util/virauthconfig.c index 818df7a252..0c9eeae76e 100644 --- a/src/util/virauthconfig.c +++ b/src/util/virauthconfig.c @@ -109,7 +109,7 @@ virAuthConfigLookup(virAuthConfig *auth, if (!(authcred = g_key_file_get_string(auth->keyfile, authgroup, "credentials", NULL))) { virReportError(VIR_ERR_CONF_SYNTAX, - _("Missing item 'credentials' in group '%s' in '%s'"), + _("Missing item 'credentials' in group '%1$s' in '%2$s'"), authgroup, auth->path); return -1; } @@ -118,7 +118,7 @@ virAuthConfigLookup(virAuthConfig *auth, if (!g_key_file_has_group(auth->keyfile, credgroup)) { virReportError(VIR_ERR_CONF_SYNTAX, - _("Missing group 'credentials-%s' referenced from group '%s' in '%s'"), + _("Missing group 'credentials-%1$s' referenced from group '%2$s' in '%3$s'"), authcred, authgroup, auth->path); return -1; } diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c index 48ffed0a0f..e48224d709 100644 --- a/src/util/virbitmap.c +++ b/src/util/virbitmap.c @@ -478,7 +478,7 @@ virBitmapParseInternal(const char *str, error: virReportError(VIR_ERR_INVALID_ARG, - _("Failed to parse bitmap '%s'"), str); + _("Failed to parse bitmap '%1$s'"), str); return -1; } @@ -996,7 +996,7 @@ virBitmapNewString(const char *string) if (strspn(string, "0123456789abcdefABCDEF") != len) { virReportError(VIR_ERR_INVALID_ARG, - _("Invalid hexadecimal string '%s'"), string); + _("Invalid hexadecimal string '%1$s'"), string); return NULL; } diff --git a/src/util/virccw.c b/src/util/virccw.c index d741743050..c6be013e16 100644 --- a/src/util/virccw.c +++ b/src/util/virccw.c @@ -64,7 +64,7 @@ virCCWDeviceAddressFromString(const char *address) &ccw->ssid, &ccw->devno) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to parse CCW address '%s'"), + _("Failed to parse CCW address '%1$s'"), address); return NULL; } diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index 73675b4478..b424e1b5d4 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -353,7 +353,7 @@ virCgroupDetectPlacement(virCgroup *group, mapping = fopen(procfile, "r"); if (mapping == NULL) { virReportSystemError(errno, - _("Unable to open '%s'"), + _("Unable to open '%1$s'"), procfile); goto cleanup; } @@ -464,14 +464,14 @@ virCgroupGetBlockDevString(const char *path) if (stat(path, &sb) < 0) { virReportSystemError(errno, - _("Path '%s' is not accessible"), + _("Path '%1$s' is not accessible"), path); return NULL; } if (!S_ISBLK(sb.st_mode)) { virReportSystemError(EINVAL, - _("Path '%s' must be a block device"), + _("Path '%1$s' must be a block device"), path); return NULL; } @@ -524,12 +524,12 @@ virCgroupSetValueRaw(const char *path, if (errno == EINVAL && (tmp = strrchr(path, '/'))) { virReportSystemError(errno, - _("Invalid value '%s' for '%s'"), + _("Invalid value '%1$s' for '%2$s'"), value, tmp + 1); return -1; } virReportSystemError(errno, - _("Unable to write to '%s'"), path); + _("Unable to write to '%1$s'"), path); return -1; } @@ -549,7 +549,7 @@ virCgroupGetValueRaw(const char *path, if ((rc = virFileReadAll(path, 1024*1024, value)) < 0) { virReportSystemError(errno, - _("Unable to read from '%s'"), path); + _("Unable to read from '%1$s'"), path); return -1; } @@ -656,7 +656,7 @@ virCgroupGetValueI64(virCgroup *group, if (virStrToLong_ll(strval, NULL, 10, value) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to parse '%s' as an integer"), + _("Unable to parse '%1$s' as an integer"), strval); return -1; } @@ -678,7 +678,7 @@ virCgroupGetValueU64(virCgroup *group, if (virStrToLong_ull(strval, NULL, 10, value) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to parse '%s' as an integer"), + _("Unable to parse '%1$s' as an integer"), strval); return -1; } @@ -947,7 +947,7 @@ virCgroupNewPartition(const char *path, if (!g_path_is_absolute(path)) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Partition path '%s' must start with '/'"), + _("Partition path '%1$s' must start with '/'"), path); return -1; } @@ -1125,7 +1125,7 @@ virCgroupNewThread(virCgroup *domain, break; case VIR_CGROUP_THREAD_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected name value %d"), nameval); + _("unexpected name value %1$d"), nameval); return -1; } @@ -1508,7 +1508,7 @@ virCgroupPathOfController(virCgroup *group, { if (controller >= VIR_CGROUP_CONTROLLER_LAST) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid controller id '%d'"), controller); + _("Invalid controller id '%1$d'"), controller); return -1; } @@ -2187,7 +2187,7 @@ virCgroupAllowDevicePath(virCgroup *group, return 1; virReportSystemError(errno, - _("Path '%s' is not accessible"), + _("Path '%1$s' is not accessible"), path); return -1; } @@ -2254,7 +2254,7 @@ virCgroupDenyDevicePath(virCgroup *group, return 1; virReportSystemError(errno, - _("Path '%s' is not accessible"), + _("Path '%1$s' is not accessible"), path); return -1; } @@ -2383,7 +2383,7 @@ virCgroupGetPercpuStats(virCgroup *group, if (start_cpu >= total_cpus) { virReportError(VIR_ERR_INVALID_ARG, - _("start_cpu %d larger than maximum of %d"), + _("start_cpu %1$d larger than maximum of %2$d"), start_cpu, total_cpus - 1); return -1; } @@ -2582,7 +2582,7 @@ virCgroupRemoveRecursively(char *grppath) if (errno == ENOENT) return 0; rc = -errno; - VIR_ERROR(_("Unable to open %s (%d)"), grppath, errno); + VIR_ERROR(_("Unable to open %1$s (%2$d)"), grppath, errno); return rc; } @@ -2601,13 +2601,13 @@ virCgroupRemoveRecursively(char *grppath) } if (direrr < 0) { rc = -errno; - VIR_ERROR(_("Failed to readdir for %s (%d)"), grppath, errno); + VIR_ERROR(_("Failed to readdir for %1$s (%2$d)"), grppath, errno); } VIR_DEBUG("Removing cgroup %s", grppath); if (rmdir(grppath) != 0 && errno != ENOENT) { rc = -errno; - VIR_ERROR(_("Unable to remove %s (%d)"), grppath, errno); + VIR_ERROR(_("Unable to remove %1$s (%2$d)"), grppath, errno); } return rc; @@ -2677,7 +2677,7 @@ virCgroupKillInternal(virCgroup *group, } virReportSystemError(errno, - _("Failed to read %s"), + _("Failed to read %1$s"), keypath); goto cleanup; } else { @@ -2688,7 +2688,7 @@ virCgroupKillInternal(virCgroup *group, if (feof(fp)) break; virReportSystemError(errno, - _("Failed to read %s"), + _("Failed to read %1$s"), keypath); goto cleanup; } @@ -2701,7 +2701,7 @@ virCgroupKillInternal(virCgroup *group, if (kill((pid_t)*pid_value, signum) < 0) { if (errno != ESRCH) { virReportSystemError(errno, - _("Failed to kill process %lld"), + _("Failed to kill process %1$lld"), *pid_value); goto cleanup; } @@ -3025,7 +3025,7 @@ virCgroupGetInode(virCgroup *cgroup) return -1; if (stat(path, &st) < 0) { - virReportSystemError(errno, _("failed to get stat for '%s'"), path); + virReportSystemError(errno, _("failed to get stat for '%1$s'"), path); return -1; } diff --git a/src/util/vircgroupbackend.c b/src/util/vircgroupbackend.c index 6d6f82cbb1..ee049c13b9 100644 --- a/src/util/vircgroupbackend.c +++ b/src/util/vircgroupbackend.c @@ -43,7 +43,7 @@ virCgroupBackendRegister(virCgroupBackend *backend) { if (virCgroupBackends[backend->type]) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Cgroup backend '%s' already registered."), + _("Cgroup backend '%1$s' already registered."), virCgroupBackendTypeToString(backend->type)); return; } diff --git a/src/util/vircgroupbackend.h b/src/util/vircgroupbackend.h index c4d56896b0..ee2f6c1ec7 100644 --- a/src/util/vircgroupbackend.h +++ b/src/util/vircgroupbackend.h @@ -466,13 +466,13 @@ virCgroupBackendForController(virCgroup *group, virCgroupBackend *backend = virCgroupBackendForController(group, controller); \ if (!backend) { \ virReportError(VIR_ERR_INTERNAL_ERROR, \ - _("failed to get cgroup backend for '%s' controller '%u'"), \ + _("failed to get cgroup backend for '%1$s' controller '%2$u'"), \ #func, controller); \ return ret; \ } \ if (!backend->func) { \ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, \ - _("operation '%s' not supported for backend '%s'"), \ + _("operation '%1$s' not supported for backend '%2$s'"), \ #func, virCgroupBackendTypeToString(backend->type)); \ return ret; \ } \ diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c index cbee08e931..c0cac2a6b6 100644 --- a/src/util/vircgroupv1.c +++ b/src/util/vircgroupv1.c @@ -230,7 +230,7 @@ virCgroupV1ResolveMountLink(const char *mntDir, dirName = strrchr(tmp, '/'); if (!dirName) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Missing '/' separator in cgroup mount '%s'"), tmp); + _("Missing '/' separator in cgroup mount '%1$s'"), tmp); return -1; } @@ -246,7 +246,7 @@ virCgroupV1ResolveMountLink(const char *mntDir, VIR_WARN("Controller %s co-mounted at %s is missing symlink at %s", typeStr, tmp, linkSrc); } else { - virReportSystemError(errno, _("Cannot stat %s"), linkSrc); + virReportSystemError(errno, _("Cannot stat %1$s"), linkSrc); return -1; } } else { @@ -409,7 +409,7 @@ virCgroupV1ValidatePlacement(virCgroup *group, if (!group->legacy[i].placement) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not find placement for v1 controller %s"), + _("Could not find placement for v1 controller %1$s"), virCgroupV1ControllerTypeToString(i)); return -1; } @@ -478,7 +478,7 @@ virCgroupV1DetectControllers(virCgroup *group, if (STREQ_NULLABLE(group->legacy[i].mountPoint, group->legacy[j].mountPoint)) { virReportSystemError(EINVAL, - _("V1 controller '%s' is not wanted, but '%s' is co-mounted"), + _("V1 controller '%1$s' is not wanted, but '%2$s' is co-mounted"), virCgroupV1ControllerTypeToString(i), virCgroupV1ControllerTypeToString(j)); return -1; @@ -547,14 +547,14 @@ virCgroupV1PathOfController(virCgroup *group, { if (group->legacy[controller].mountPoint == NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("v1 controller '%s' is not mounted"), + _("v1 controller '%1$s' is not mounted"), virCgroupV1ControllerTypeToString(controller)); return -1; } if (group->legacy[controller].placement == NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("v1 controller '%s' is not enabled for group"), + _("v1 controller '%1$s' is not enabled for group"), virCgroupV1ControllerTypeToString(controller)); return -1; } @@ -670,7 +670,7 @@ virCgroupV1MakeGroup(virCgroup *parent, continue; } else { virReportSystemError(errno, - _("Failed to create v1 controller %s for group"), + _("Failed to create v1 controller %1$s for group"), virCgroupV1ControllerTypeToString(i)); return -1; } @@ -828,7 +828,7 @@ virCgroupV1IdentifyRoot(virCgroup *group) continue; if (!(tmp = strrchr(group->legacy[i].mountPoint, '/'))) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not find directory separator in %s"), + _("Could not find directory separator in %1$s"), group->legacy[i].mountPoint); return NULL; } @@ -860,7 +860,7 @@ virCgroupV1BindMount(virCgroup *group, if (g_mkdir_with_parents(root, 0777) < 0) { virReportSystemError(errno, - _("Unable to create directory %s"), + _("Unable to create directory %1$s"), root); return -1; } @@ -869,7 +869,7 @@ virCgroupV1BindMount(virCgroup *group, if (mount("tmpfs", root, "tmpfs", MS_NOSUID|MS_NODEV|MS_NOEXEC, opts) < 0) { virReportSystemError(errno, - _("Failed to mount %s on %s type %s"), + _("Failed to mount %1$s on %2$s type %3$s"), "tmpfs", root, "tmpfs"); return -1; } @@ -886,7 +886,7 @@ virCgroupV1BindMount(virCgroup *group, group->legacy[i].mountPoint); if (g_mkdir_with_parents(group->legacy[i].mountPoint, 0777) < 0) { virReportSystemError(errno, - _("Unable to create directory %s"), + _("Unable to create directory %1$s"), group->legacy[i].mountPoint); return -1; } @@ -894,7 +894,7 @@ virCgroupV1BindMount(virCgroup *group, if (mount(src, group->legacy[i].mountPoint, "none", MS_BIND, NULL) < 0) { virReportSystemError(errno, - _("Failed to bind cgroup '%s' on '%s'"), + _("Failed to bind cgroup '%1$s' on '%2$s'"), src, group->legacy[i].mountPoint); return -1; } @@ -907,7 +907,7 @@ virCgroupV1BindMount(virCgroup *group, if (symlink(group->legacy[i].mountPoint, group->legacy[i].linkPoint) < 0) { virReportSystemError(errno, - _("Unable to symlink directory %s to %s"), + _("Unable to symlink directory %1$s to %2$s"), group->legacy[i].mountPoint, group->legacy[i].linkPoint); return -1; @@ -952,7 +952,7 @@ virCgroupV1SetOwner(virCgroup *cgroup, if (chown(entry, uid, gid) < 0) { virReportSystemError(errno, - _("cannot chown '%s' to (%u, %u)"), + _("cannot chown '%1$s' to (%2$u, %3$u)"), entry, uid, gid); return -1; } @@ -962,7 +962,7 @@ virCgroupV1SetOwner(virCgroup *cgroup, if (chown(base, uid, gid) < 0) { virReportSystemError(errno, - _("cannot chown '%s' to (%u, %u)"), + _("cannot chown '%1$s' to (%2$u, %3$u)"), base, uid, gid); return -1; } @@ -1042,7 +1042,7 @@ virCgroupV1GetBlkioWeight(virCgroup *group, if (virStrToLong_ui(value, NULL, 10, weight) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to parse '%s' as an integer"), + _("Unable to parse '%1$s' as an integer"), value); return -1; } @@ -1102,7 +1102,7 @@ virCgroupV1GetBlkioIoServiced(virCgroup *group, p1 += strlen(value_names[i]); if (virStrToLong_ll(p1, &p1, 10, &stats_val) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Cannot parse byte %sstat '%s'"), + _("Cannot parse byte %1$sstat '%2$s'"), value_names[i], p1); return -1; @@ -1112,7 +1112,7 @@ virCgroupV1GetBlkioIoServiced(virCgroup *group, (stats_val > 0 && *bytes_ptrs[i] > (LLONG_MAX - stats_val))) { virReportError(VIR_ERR_OVERFLOW, - _("Sum of byte %sstat overflows"), + _("Sum of byte %1$sstat overflows"), value_names[i]); return -1; } @@ -1123,7 +1123,7 @@ virCgroupV1GetBlkioIoServiced(virCgroup *group, p2 += strlen(value_names[i]); if (virStrToLong_ll(p2, &p2, 10, &stats_val) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Cannot parse %srequest stat '%s'"), + _("Cannot parse %1$srequest stat '%2$s'"), value_names[i], p2); return -1; @@ -1133,7 +1133,7 @@ virCgroupV1GetBlkioIoServiced(virCgroup *group, (stats_val > 0 && *requests_ptrs[i] > (LLONG_MAX - stats_val))) { virReportError(VIR_ERR_OVERFLOW, - _("Sum of %srequest stat overflows"), + _("Sum of %1$srequest stat overflows"), value_names[i]); return -1; } @@ -1188,14 +1188,14 @@ virCgroupV1GetBlkioIoDeviceServiced(virCgroup *group, if (!(p1 = strstr(str1, str3))) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Cannot find byte stats for block device '%s'"), + _("Cannot find byte stats for block device '%1$s'"), str3); return -1; } if (!(p2 = strstr(str2, str3))) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Cannot find request stats for block device '%s'"), + _("Cannot find request stats for block device '%1$s'"), str3); return -1; } @@ -1203,28 +1203,28 @@ virCgroupV1GetBlkioIoDeviceServiced(virCgroup *group, for (i = 0; i < G_N_ELEMENTS(value_names); i++) { if (!(p1 = strstr(p1, value_names[i]))) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Cannot find byte %sstats for block device '%s'"), + _("Cannot find byte %1$sstats for block device '%2$s'"), value_names[i], str3); return -1; } if (virStrToLong_ll(p1 + strlen(value_names[i]), &p1, 10, bytes_ptrs[i]) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Cannot parse %sstat '%s'"), + _("Cannot parse %1$sstat '%2$s'"), value_names[i], p1 + strlen(value_names[i])); return -1; } if (!(p2 = strstr(p2, value_names[i]))) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Cannot find request %sstats for block device '%s'"), + _("Cannot find request %1$sstats for block device '%2$s'"), value_names[i], str3); return -1; } if (virStrToLong_ll(p2 + strlen(value_names[i]), &p2, 10, requests_ptrs[i]) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Cannot parse %sstat '%s'"), + _("Cannot parse %1$sstat '%2$s'"), value_names[i], p2 + strlen(value_names[i])); return -1; } @@ -1302,7 +1302,7 @@ virCgroupV1GetBlkioDeviceWeight(virCgroup *group, *weight = 0; } else if (virStrToLong_ui(str, NULL, 10, weight) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to parse '%s' as an integer"), + _("Unable to parse '%1$s' as an integer"), str); return -1; } @@ -1353,7 +1353,7 @@ virCgroupV1GetBlkioDeviceReadIops(virCgroup *group, *riops = 0; } else if (virStrToLong_ui(str, NULL, 10, riops) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to parse '%s' as an integer"), + _("Unable to parse '%1$s' as an integer"), str); return -1; } @@ -1404,7 +1404,7 @@ virCgroupV1GetBlkioDeviceWriteIops(virCgroup *group, *wiops = 0; } else if (virStrToLong_ui(str, NULL, 10, wiops) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to parse '%s' as an integer"), + _("Unable to parse '%1$s' as an integer"), str); return -1; } @@ -1455,7 +1455,7 @@ virCgroupV1GetBlkioDeviceReadBps(virCgroup *group, *rbps = 0; } else if (virStrToLong_ull(str, NULL, 10, rbps) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to parse '%s' as an integer"), + _("Unable to parse '%1$s' as an integer"), str); return -1; } @@ -1506,7 +1506,7 @@ virCgroupV1GetBlkioDeviceWriteBps(virCgroup *group, *wbps = 0; } else if (virStrToLong_ull(str, NULL, 10, wbps) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to parse '%s' as an integer"), + _("Unable to parse '%1$s' as an integer"), str); return -1; } @@ -1567,7 +1567,7 @@ virCgroupV1SetMemory(virCgroup *group, if (kb > maxkb) { virReportError(VIR_ERR_INVALID_ARG, - _("Memory '%llu' must be less than %llu"), + _("Memory '%1$llu' must be less than %2$llu"), kb, maxkb); return -1; } @@ -1710,7 +1710,7 @@ virCgroupV1SetMemorySoftLimit(virCgroup *group, if (kb > maxkb) { virReportError(VIR_ERR_INVALID_ARG, - _("Memory '%llu' must be less than %llu"), + _("Memory '%1$llu' must be less than %2$llu"), kb, maxkb); return -1; } @@ -1755,7 +1755,7 @@ virCgroupV1SetMemSwapHardLimit(virCgroup *group, if (kb > maxkb) { virReportError(VIR_ERR_INVALID_ARG, - _("Memory '%llu' must be less than %llu"), + _("Memory '%1$llu' must be less than %2$llu"), kb, maxkb); return -1; } @@ -1906,7 +1906,7 @@ virCgroupV1SetCpuShares(virCgroup *group, if (shares < VIR_CGROUP_CPU_SHARES_MIN || shares > VIR_CGROUP_CPU_SHARES_MAX) { virReportError(VIR_ERR_INVALID_ARG, - _("shares '%llu' must be in range [%llu, %llu]"), + _("shares '%1$llu' must be in range [%2$llu, %3$llu]"), shares, VIR_CGROUP_CPU_SHARES_MIN, VIR_CGROUP_CPU_SHARES_MAX); @@ -1942,7 +1942,7 @@ virCgroupV1SetCpuCfsPeriod(virCgroup *group, if (cfs_period < VIR_CGROUP_CPU_PERIOD_MIN || cfs_period > VIR_CGROUP_CPU_PERIOD_MAX) { virReportError(VIR_ERR_INVALID_ARG, - _("cfs_period '%llu' must be in range (%llu, %llu)"), + _("cfs_period '%1$llu' must be in range (%2$llu, %3$llu)"), cfs_period, VIR_CGROUP_CPU_PERIOD_MIN, VIR_CGROUP_CPU_PERIOD_MAX); @@ -1973,7 +1973,7 @@ virCgroupV1SetCpuCfsQuota(virCgroup *group, (cfs_quota < VIR_CGROUP_CPU_QUOTA_MIN || cfs_quota > VIR_CGROUP_CPU_QUOTA_MAX)) { virReportError(VIR_ERR_INVALID_ARG, - _("cfs_quota '%lld' must be in range (%llu, %llu)"), + _("cfs_quota '%1$lld' must be in range (%2$llu, %3$llu)"), cfs_quota, VIR_CGROUP_CPU_QUOTA_MIN, VIR_CGROUP_CPU_QUOTA_MAX); @@ -2049,14 +2049,14 @@ virCgroupV1GetCpuacctStat(virCgroup *group, if (!(p = STRSKIP(str, "user ")) || virStrToLong_ull(p, &p, 10, user) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Cannot parse user stat '%s'"), + _("Cannot parse user stat '%1$s'"), p); return -1; } if (!(p = STRSKIP(p, "\nsystem ")) || virStrToLong_ull(p, NULL, 10, sys) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Cannot parse sys stat '%s'"), + _("Cannot parse sys stat '%1$s'"), p); return -1; } diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c index 219b9c7f21..db115e25f7 100644 --- a/src/util/vircgroupv2.c +++ b/src/util/vircgroupv2.c @@ -279,7 +279,7 @@ virCgroupV2ParseControllersFile(virCgroup *group, rc = virFileReadAll(contFile, 1024 * 1024, &contStr); if (rc < 0) { - virReportSystemError(errno, _("Unable to read from '%s'"), contFile); + virReportSystemError(errno, _("Unable to read from '%1$s'"), contFile); return -1; } @@ -360,7 +360,7 @@ virCgroupV2PathOfController(virCgroup *group, { if (!virCgroupV2HasController(group, controller)) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("v2 controller '%s' is not available"), + _("v2 controller '%1$s' is not available"), virCgroupV2ControllerTypeToString(controller)); return -1; } @@ -398,7 +398,7 @@ virCgroupV2EnableController(virCgroup *group, if (virFileWriteStr(path, val, 0) < 0) { if (report) { virReportSystemError(errno, - _("Failed to enable controller '%s' for '%s'"), + _("Failed to enable controller '%1$s' for '%2$s'"), val, path); } return -2; @@ -439,7 +439,7 @@ virCgroupV2MakeGroup(virCgroup *parent, if (!virFileExists(path) && (!create || (mkdir(path, 0755) < 0 && errno != EEXIST))) { - virReportSystemError(errno, _("Failed to create v2 cgroup '%s'"), + virReportSystemError(errno, _("Failed to create v2 cgroup '%1$s'"), path); return -1; } @@ -590,7 +590,7 @@ virCgroupV2BindMount(virCgroup *group, VIR_DEBUG("Mounting cgroups at '%s'", group->unified.mountPoint); if (g_mkdir_with_parents(group->unified.mountPoint, 0777) < 0) { - virReportSystemError(errno, _("Unable to create directory %s"), + virReportSystemError(errno, _("Unable to create directory %1$s"), group->unified.mountPoint); return -1; } @@ -598,7 +598,7 @@ virCgroupV2BindMount(virCgroup *group, src = g_strdup_printf("%s%s", oldroot, group->unified.mountPoint); if (mount(src, group->unified.mountPoint, "none", MS_BIND, NULL) < 0) { - virReportSystemError(errno, _("Failed to bind cgroup '%s' on '%s'"), + virReportSystemError(errno, _("Failed to bind cgroup '%1$s' on '%2$s'"), src, group->unified.mountPoint); return -1; } @@ -622,7 +622,7 @@ virCgroupV2SetOwner(virCgroup *cgroup, return -1; if (chown(base, uid, gid) < 0) { - virReportSystemError(errno, _("cannot chown '%s' to (%u, %u)"), + virReportSystemError(errno, _("cannot chown '%1$s' to (%2$u, %3$u)"), base, uid, gid); return -1; } @@ -710,7 +710,7 @@ virCgroupV2GetBlkioWeight(virCgroup *group, if (virStrToLong_ui(tmp, &tmp, 10, weight) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to parse '%s' as an integer"), + _("Unable to parse '%1$s' as an integer"), tmp); return -1; } @@ -763,7 +763,7 @@ virCgroupV2GetBlkioIoServiced(virCgroup *group, p1 += strlen(value_names[i]); if (virStrToLong_ll(p1, &p1, 10, &stats_val) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Cannot parse byte '%s' stat '%s'"), + _("Cannot parse byte '%1$s' stat '%2$s'"), value_names[i], p1); return -1; } @@ -771,7 +771,7 @@ virCgroupV2GetBlkioIoServiced(virCgroup *group, if (stats_val < 0 || (stats_val > 0 && *value_ptrs[i] > (LLONG_MAX - stats_val))) { virReportError(VIR_ERR_OVERFLOW, - _("Sum of byte '%s' stat overflows"), + _("Sum of byte '%1$s' stat overflows"), value_names[i]); return -1; } @@ -820,7 +820,7 @@ virCgroupV2GetBlkioIoDeviceServiced(virCgroup *group, if (!(p1 = strstr(str1, str2))) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Cannot find byte stats for block device '%s'"), + _("Cannot find byte stats for block device '%1$s'"), str2); return -1; } @@ -828,7 +828,7 @@ virCgroupV2GetBlkioIoDeviceServiced(virCgroup *group, for (i = 0; i < G_N_ELEMENTS(value_names); i++) { if (!(p1 = strstr(p1, value_names[i]))) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Cannot find byte '%s' stats for block device '%s'"), + _("Cannot find byte '%1$s' stats for block device '%2$s'"), value_names[i], str2); return -1; } @@ -836,7 +836,7 @@ virCgroupV2GetBlkioIoDeviceServiced(virCgroup *group, p1 += strlen(value_names[i]); if (virStrToLong_ll(p1, &p1, 10, value_ptrs[i]) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Cannot parse '%s' stat '%s'"), + _("Cannot parse '%1$s' stat '%2$s'"), value_names[i], p1); return -1; } @@ -915,7 +915,7 @@ virCgroupV2GetBlkioDeviceWeight(virCgroup *group, *weight = 0; } else if (virStrToLong_ui(str, &tmp, 10, weight) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to parse '%s' as an integer"), + _("Unable to parse '%1$s' as an integer"), str); return -1; } @@ -973,7 +973,7 @@ virCgroupV2GetBlkioDeviceReadIops(virCgroup *group, } else { if (!(tmp = strstr(str, name))) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to find '%s' limit for block device '%s'"), + _("Unable to find '%1$s' limit for block device '%2$s'"), name, path); return -1; } @@ -983,7 +983,7 @@ virCgroupV2GetBlkioDeviceReadIops(virCgroup *group, *riops = 0; } else if (virStrToLong_ui(tmp, &tmp, 10, riops) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to parse '%s' as an integer"), + _("Unable to parse '%1$s' as an integer"), str); return -1; } @@ -1042,7 +1042,7 @@ virCgroupV2GetBlkioDeviceWriteIops(virCgroup *group, } else { if (!(tmp = strstr(str, name))) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to find '%s' limit for block device '%s'"), + _("Unable to find '%1$s' limit for block device '%2$s'"), name, path); return -1; } @@ -1052,7 +1052,7 @@ virCgroupV2GetBlkioDeviceWriteIops(virCgroup *group, *wiops = 0; } else if (virStrToLong_ui(tmp, &tmp, 10, wiops) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to parse '%s' as an integer"), + _("Unable to parse '%1$s' as an integer"), str); return -1; } @@ -1111,7 +1111,7 @@ virCgroupV2GetBlkioDeviceReadBps(virCgroup *group, } else { if (!(tmp = strstr(str, name))) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to find '%s' limit for block device '%s'"), + _("Unable to find '%1$s' limit for block device '%2$s'"), name, path); return -1; } @@ -1121,7 +1121,7 @@ virCgroupV2GetBlkioDeviceReadBps(virCgroup *group, *rbps = 0; } else if (virStrToLong_ull(tmp, &tmp, 10, rbps) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to parse '%s' as an integer"), + _("Unable to parse '%1$s' as an integer"), str); return -1; } @@ -1180,7 +1180,7 @@ virCgroupV2GetBlkioDeviceWriteBps(virCgroup *group, } else { if (!(tmp = strstr(str, name))) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to find '%s' limit for block device '%s'"), + _("Unable to find '%1$s' limit for block device '%2$s'"), name, path); return -1; } @@ -1190,7 +1190,7 @@ virCgroupV2GetBlkioDeviceWriteBps(virCgroup *group, *wbps = 0; } else if (virStrToLong_ull(tmp, &tmp, 10, wbps) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to parse '%s' as an integer"), + _("Unable to parse '%1$s' as an integer"), str); return -1; } @@ -1208,7 +1208,7 @@ virCgroupV2SetMemory(virCgroup *group, if (kb > maxkb) { virReportError(VIR_ERR_INVALID_ARG, - _("Memory '%llu' must be less than %llu"), + _("Memory '%1$llu' must be less than %2$llu"), kb, maxkb); return -1; } @@ -1271,7 +1271,7 @@ virCgroupV2GetMemoryStat(virCgroup *group, if (virStrToLong_ull(valueStr + 1, NULL, 10, &value) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to parse '%s' as an integer"), + _("Unable to parse '%1$s' as an integer"), valueStr + 1); return -1; } @@ -1348,7 +1348,7 @@ virCgroupV2GetMemoryHardLimit(virCgroup *group, if (virStrToLong_ull(value, NULL, 10, &max) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to parse value '%s' as number."), + _("Failed to parse value '%1$s' as number."), value); return -1; } @@ -1369,7 +1369,7 @@ virCgroupV2SetMemorySoftLimit(virCgroup *group, if (kb > maxkb) { virReportError(VIR_ERR_INVALID_ARG, - _("Memory '%llu' must be less than %llu"), + _("Memory '%1$llu' must be less than %2$llu"), kb, maxkb); return -1; } @@ -1407,7 +1407,7 @@ virCgroupV2GetMemorySoftLimit(virCgroup *group, if (virStrToLong_ull(value, NULL, 10, &high) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to parse value '%s' as number."), + _("Failed to parse value '%1$s' as number."), value); return -1; } @@ -1428,7 +1428,7 @@ virCgroupV2SetMemSwapHardLimit(virCgroup *group, if (kb > maxkb) { virReportError(VIR_ERR_INVALID_ARG, - _("Memory '%llu' must be less than %llu"), + _("Memory '%1$llu' must be less than %2$llu"), kb, maxkb); return -1; } @@ -1467,7 +1467,7 @@ virCgroupV2GetMemSwapHardLimit(virCgroup *group, if (virStrToLong_ull(value, NULL, 10, &max) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to parse value '%s' as number."), + _("Failed to parse value '%1$s' as number."), value); return -1; } @@ -1502,7 +1502,7 @@ virCgroupV2SetCpuShares(virCgroup *group, if (shares < VIR_CGROUPV2_WEIGHT_MIN || shares > VIR_CGROUPV2_WEIGHT_MAX) { virReportError(VIR_ERR_INVALID_ARG, - _("shares '%llu' must be in range [%llu, %llu]"), + _("shares '%1$llu' must be in range [%2$llu, %3$llu]"), shares, VIR_CGROUPV2_WEIGHT_MIN, VIR_CGROUPV2_WEIGHT_MAX); @@ -1542,7 +1542,7 @@ virCgroupV2SetCpuCfsPeriod(virCgroup *group, if (cfs_period < VIR_CGROUP_CPU_PERIOD_MIN || cfs_period > VIR_CGROUP_CPU_PERIOD_MAX) { virReportError(VIR_ERR_INVALID_ARG, - _("cfs_period '%llu' must be in range (%llu, %llu)"), + _("cfs_period '%1$llu' must be in range (%2$llu, %3$llu)"), VIR_CGROUP_CPU_PERIOD_MIN, VIR_CGROUP_CPU_PERIOD_MAX, cfs_period); @@ -1588,7 +1588,7 @@ virCgroupV2GetCpuCfsPeriod(virCgroup *group, if (virStrToLong_ull(tmp, &tmp, 10, cfs_period) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to parse value '%s' from cpu.max."), str); + _("Failed to parse value '%1$s' from cpu.max."), str); return -1; } @@ -1604,7 +1604,7 @@ virCgroupV2SetCpuCfsQuota(virCgroup *group, (cfs_quota < VIR_CGROUP_CPU_QUOTA_MIN || cfs_quota > VIR_CGROUP_CPU_QUOTA_MAX)) { virReportError(VIR_ERR_INVALID_ARG, - _("cfs_quota '%lld' must be in range (%llu, %llu)"), + _("cfs_quota '%1$lld' must be in range (%2$llu, %3$llu)"), cfs_quota, VIR_CGROUP_CPU_QUOTA_MIN, VIR_CGROUP_CPU_QUOTA_MAX); @@ -1642,7 +1642,7 @@ virCgroupV2GetCpuCfsQuota(virCgroup *group, if (virStrToLong_ll(str, &tmp, 10, cfs_quota) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to parse value '%s' from cpu.max."), str); + _("Failed to parse value '%1$s' from cpu.max."), str); return -1; } @@ -1679,14 +1679,14 @@ virCgroupV2GetCpuacctUsage(virCgroup *group, if (!(tmp = strstr(str, "usage_usec "))) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse cpu usage stat '%s'"), str); + _("cannot parse cpu usage stat '%1$s'"), str); return -1; } tmp += strlen("usage_usec "); if (virStrToLong_ull(tmp, &tmp, 10, usage) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to parse value '%s' as number."), tmp); + _("Failed to parse value '%1$s' as number."), tmp); return -1; } @@ -1713,27 +1713,27 @@ virCgroupV2GetCpuacctStat(virCgroup *group, if (!(tmp = strstr(str, "user_usec "))) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse cpu user stat '%s'"), str); + _("cannot parse cpu user stat '%1$s'"), str); return -1; } tmp += strlen("user_usec "); if (virStrToLong_ull(tmp, &tmp, 10, &userVal) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to parse value '%s' as number."), tmp); + _("Failed to parse value '%1$s' as number."), tmp); return -1; } if (!(tmp = strstr(str, "system_usec "))) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse cpu sys stat '%s'"), str); + _("cannot parse cpu sys stat '%1$s'"), str); return -1; } tmp += strlen("system_usec "); if (virStrToLong_ull(tmp, &tmp, 10, &sysVal) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to parse value '%s' as number."), tmp); + _("Failed to parse value '%1$s' as number."), tmp); return -1; } diff --git a/src/util/vircgroupv2devices.c b/src/util/vircgroupv2devices.c index 05818c4130..f740127bbc 100644 --- a/src/util/vircgroupv2devices.c +++ b/src/util/vircgroupv2devices.c @@ -297,7 +297,7 @@ virCgroupV2DevicesAttachProg(virCgroup *group, cgroupfd = open(path, O_RDONLY); if (cgroupfd < 0) { - virReportSystemError(errno, _("unable to open '%s'"), path); + virReportSystemError(errno, _("unable to open '%1$s'"), path); goto cleanup; } @@ -375,7 +375,7 @@ virCgroupV2DevicesDetectProg(virCgroup *group) cgroupfd = open(path, O_RDONLY); if (cgroupfd < 0) { - virReportSystemError(errno, _("unable to open '%s'"), path); + virReportSystemError(errno, _("unable to open '%1$s'"), path); return -1; } diff --git a/src/util/vircommand.c b/src/util/vircommand.c index 757d462ba1..49abb53c28 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -372,7 +372,7 @@ getDevNull(int *null) { if (*null == -1 && (*null = open("/dev/null", O_RDWR|O_CLOEXEC)) < 0) { virReportSystemError(errno, - _("cannot open %s"), + _("cannot open %1$s"), "/dev/null"); return -1; } @@ -428,7 +428,7 @@ virCommandHandshakeChild(virCommand *cmd) } if (c != '1') { virReportSystemError(EINVAL, - _("Unexpected confirm code '%c' from parent"), + _("Unexpected confirm code '%1$c' from parent"), c); return -1; } @@ -453,7 +453,7 @@ virExecCommon(virCommand *cmd, gid_t *groups, int ngroups) if (cmd->schedCore > 0 && virProcessSchedCoreShareFrom(cmd->schedCore) < 0) { virReportSystemError(errno, - _("Unable to run among %llu"), + _("Unable to run among %1$llu"), (unsigned long long) cmd->schedCore); return -1; } @@ -472,7 +472,7 @@ virExecCommon(virCommand *cmd, gid_t *groups, int ngroups) VIR_DEBUG("Running child in %s", cmd->pwd); if (chdir(cmd->pwd) < 0) { virReportSystemError(errno, - _("Unable to change to %s"), cmd->pwd); + _("Unable to change to %1$s"), cmd->pwd); return -1; } } @@ -501,7 +501,7 @@ virCommandMassCloseGetFDsLinux(virCommand *cmd G_GNUC_UNUSED, if (virStrToLong_i(entry->d_name, NULL, 10, &fd) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("unable to parse FD: %s"), + _("unable to parse FD: %1$s"), entry->d_name); return -1; } @@ -568,7 +568,7 @@ virCommandMassClose(virCommand *cmd, int tmpfd = fd; VIR_MASS_CLOSE(tmpfd); } else if (virSetInherit(fd, true) < 0) { - virReportSystemError(errno, _("failed to preserve fd %d"), fd); + virReportSystemError(errno, _("failed to preserve fd %1$d"), fd); return -1; } } @@ -621,7 +621,7 @@ virCommandMassClose(virCommand *cmd, int tmpfd = fd; VIR_MASS_CLOSE(tmpfd); } else if (virSetInherit(fd, true) < 0) { - virReportSystemError(errno, _("failed to preserve fd %d"), fd); + virReportSystemError(errno, _("failed to preserve fd %1$d"), fd); return -1; } } @@ -867,8 +867,7 @@ virExec(virCommand *cmd) VIR_DEBUG("Setting child security label to %s", cmd->seLinuxLabel); if (setexeccon_raw(cmd->seLinuxLabel) == -1) { virReportSystemError(errno, - _("unable to set SELinux security context " - "'%s' for '%s'"), + _("unable to set SELinux security context '%1$s' for '%2$s'"), cmd->seLinuxLabel, cmd->args[0]); if (security_getenforce() == 1) goto fork_error; @@ -880,8 +879,7 @@ virExec(virCommand *cmd) VIR_DEBUG("Setting child AppArmor profile to %s", cmd->appArmorProfile); if (aa_change_profile(cmd->appArmorProfile) < 0) { virReportSystemError(errno, - _("unable to set AppArmor profile '%s' " - "for '%s'"), + _("unable to set AppArmor profile '%1$s' for '%2$s'"), cmd->appArmorProfile, cmd->args[0]); goto fork_error; } @@ -904,7 +902,7 @@ virExec(virCommand *cmd) ret = errno == ENOENT ? EXIT_ENOENT : EXIT_CANNOT_INVOKE; virReportSystemError(errno, - _("cannot execute binary %s"), + _("cannot execute binary %1$s"), cmd->args[0]); fork_error: @@ -2182,7 +2180,7 @@ virCommandGetBinaryPath(virCommand *cmd) if (!(cmd->binaryPath = virFindFileInPath(cmd->args[0]))) { virReportSystemError(ENOENT, - _("Cannot find '%s' in path"), + _("Cannot find '%1$s' in path"), cmd->args[0]); return NULL; } @@ -2369,7 +2367,7 @@ int virCommandExec(virCommand *cmd, gid_t *groups, int ngroups) execve(cmd->args[0], cmd->args, cmd->env); virReportSystemError(errno, - _("cannot execute binary %s"), + _("cannot execute binary %1$s"), cmd->args[0]); return -1; } @@ -2584,7 +2582,7 @@ virCommandRunAsync(virCommand *cmd, pid_t *pid) if (cmd->pid != -1) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("command is already running as pid %lld"), + _("command is already running as pid %1$lld"), (long long) cmd->pid); goto cleanup; } @@ -2596,7 +2594,7 @@ virCommandRunAsync(virCommand *cmd, pid_t *pid) } if (cmd->pwd && (cmd->flags & VIR_EXEC_DAEMON)) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("daemonized command cannot set working directory %s"), + _("daemonized command cannot set working directory %1$s"), cmd->pwd); goto cleanup; } @@ -2750,7 +2748,7 @@ virCommandWait(virCommand *cmd, int *exitstatus) bool haveErrMsg = cmd->errbuf && *cmd->errbuf && (*cmd->errbuf)[0]; virReportError(VIR_ERR_INTERNAL_ERROR, - _("Child process (%s) unexpected %s%s%s"), + _("Child process (%1$s) unexpected %2$s%3$s%4$s"), str ? str : cmd->args[0], NULLSTR(st), haveErrMsg ? ": " : "", haveErrMsg ? *cmd->errbuf : ""); @@ -3260,7 +3258,7 @@ virCommandRunRegex(virCommand *cmd, reg[i] = g_regex_new(regex[i], G_REGEX_OPTIMIZE, 0, &err); if (!reg[i]) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to compile regex %s"), err->message); + _("Failed to compile regex %1$s"), err->message); for (j = 0; j < i; j++) g_regex_unref(reg[j]); VIR_FREE(reg); @@ -3426,7 +3424,7 @@ virCommandRunRegex(virCommand *cmd G_GNUC_UNUSED, int *exitstatus G_GNUC_UNUSED) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("%s not implemented on Win32"), __FUNCTION__); + _("%1$s not implemented on Win32"), __FUNCTION__); return -1; } @@ -3437,7 +3435,7 @@ virCommandRunNul(virCommand *cmd G_GNUC_UNUSED, void *data G_GNUC_UNUSED) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("%s not implemented on Win32"), __FUNCTION__); + _("%1$s not implemented on Win32"), __FUNCTION__); return -1; } #endif /* WIN32 */ diff --git a/src/util/virconf.c b/src/util/virconf.c index c39489973b..934632a35f 100644 --- a/src/util/virconf.c +++ b/src/util/virconf.c @@ -106,7 +106,7 @@ virConfErrorHelper(const char *file, const char *func, size_t line, /* Construct the string 'filename:line: info' if we have that. */ if (ctxt && ctxt->filename) { virReportErrorHelper(VIR_FROM_CONF, error, file, func, line, - _("%s:%d: %s"), ctxt->filename, ctxt->line, info); + _("%1$s:%2$d: %3$s"), ctxt->filename, ctxt->line, info); } else { virReportErrorHelper(VIR_FROM_CONF, error, file, func, line, "%s", info); @@ -870,7 +870,7 @@ int virConfGetValueString(virConf *conf, if (cval->type != VIR_CONF_STRING) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("%s: expected a string for '%s' parameter"), + _("%1$s: expected a string for '%2$s' parameter"), conf->filename, setting); return -1; } @@ -924,7 +924,7 @@ int virConfGetValueStringList(virConf *conf, for (len = 0, eval = cval->list; eval; len++, eval = eval->next) { if (eval->type != VIR_CONF_STRING) { virReportError(VIR_ERR_CONF_SYNTAX, - _("%s: expected a string list for '%s' parameter"), + _("%1$s: expected a string list for '%2$s' parameter"), conf->filename, setting); return -1; } @@ -950,8 +950,8 @@ int virConfGetValueStringList(virConf *conf, case VIR_CONF_NONE: virReportError(VIR_ERR_INTERNAL_ERROR, compatString ? - _("%s: expected a string or string list for '%s' parameter") : - _("%s: expected a string list for '%s' parameter"), + _("%1$s: expected a string or string list for '%2$s' parameter") : + _("%1$s: expected a string list for '%2$s' parameter"), conf->filename, setting); return -1; @@ -994,14 +994,14 @@ int virConfGetValueBool(virConf *conf, if (cval->type != VIR_CONF_ULLONG) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("%s: expected a bool for '%s' parameter"), + _("%1$s: expected a bool for '%2$s' parameter"), conf->filename, setting); return -1; } if (((unsigned long long)cval->l) > 1) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("%s: value for '%s' parameter must be 0 or 1"), + _("%1$s: value for '%2$s' parameter must be 0 or 1"), conf->filename, setting); return -1; } @@ -1043,14 +1043,14 @@ int virConfGetValueInt(virConf *conf, if (cval->type != VIR_CONF_LLONG && cval->type != VIR_CONF_ULLONG) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("%s: expected a signed integer for '%s' parameter"), + _("%1$s: expected a signed integer for '%2$s' parameter"), conf->filename, setting); return -1; } if (cval->l > INT_MAX || cval->l < INT_MIN) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("%s: value for '%s' parameter must be in range %d:%d"), + _("%1$s: value for '%2$s' parameter must be in range %3$d:%4$d"), conf->filename, setting, INT_MIN, INT_MAX); return -1; } @@ -1091,14 +1091,14 @@ int virConfGetValueUInt(virConf *conf, if (cval->type != VIR_CONF_ULLONG) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("%s: expected an unsigned integer for '%s' parameter"), + _("%1$s: expected an unsigned integer for '%2$s' parameter"), conf->filename, setting); return -1; } if (((unsigned long long)cval->l) > UINT_MAX) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("%s: value for '%s' parameter must be in range 0:%u"), + _("%1$s: value for '%2$s' parameter must be in range 0:%3$u"), conf->filename, setting, UINT_MAX); return -1; } @@ -1139,7 +1139,7 @@ int virConfGetValueSizeT(virConf *conf, if (cval->type != VIR_CONF_ULLONG) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("%s: expected an unsigned integer for '%s' parameter"), + _("%1$s: expected an unsigned integer for '%2$s' parameter"), conf->filename, setting); return -1; } @@ -1147,7 +1147,7 @@ int virConfGetValueSizeT(virConf *conf, #if ULLONG_MAX > SIZE_MAX if (((unsigned long long)cval->l) > SIZE_MAX) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("%s: value for '%s' parameter must be in range 0:%zu"), + _("%1$s: value for '%2$s' parameter must be in range 0:%3$zu"), conf->filename, setting, SIZE_MAX); return -1; } @@ -1190,7 +1190,7 @@ int virConfGetValueSSizeT(virConf *conf, if (cval->type == VIR_CONF_ULLONG) { if (((unsigned long long)cval->l) > SSIZE_MAX) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("%s: value for '%s' parameter must be in range %zd:%zd"), + _("%1$s: value for '%2$s' parameter must be in range %3$zd:%4$zd"), conf->filename, setting, (ssize_t)-SSIZE_MAX - 1, (ssize_t)SSIZE_MAX); return -1; } @@ -1198,14 +1198,14 @@ int virConfGetValueSSizeT(virConf *conf, #if SSIZE_MAX < LLONG_MAX if (cval->l < (-SSIZE_MAX - 1) || cval->l > SSIZE_MAX) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("%s: value for '%s' parameter must be in range %zd:%zd"), + _("%1$s: value for '%2$s' parameter must be in range %3$zd:%4$zd"), conf->filename, setting, (ssize_t)-SSIZE_MAX - 1, (ssize_t)SSIZE_MAX); return -1; } #endif } else { virReportError(VIR_ERR_INTERNAL_ERROR, - _("%s: expected a signed integer for '%s' parameter"), + _("%1$s: expected a signed integer for '%2$s' parameter"), conf->filename, setting); return -1; } @@ -1247,13 +1247,13 @@ int virConfGetValueLLong(virConf *conf, if (cval->type == VIR_CONF_ULLONG) { if (((unsigned long long)cval->l) > LLONG_MAX) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("%s: value for '%s' parameter must be in range %lld:%lld"), + _("%1$s: value for '%2$s' parameter must be in range %3$lld:%4$lld"), conf->filename, setting, LLONG_MIN, LLONG_MAX); return -1; } } else if (cval->type != VIR_CONF_LLONG) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("%s: expected a signed integer for '%s' parameter"), + _("%1$s: expected a signed integer for '%2$s' parameter"), conf->filename, setting); return -1; } @@ -1293,7 +1293,7 @@ int virConfGetValueULLong(virConf *conf, if (cval->type != VIR_CONF_ULLONG) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("%s: expected an unsigned integer for '%s' parameter"), + _("%1$s: expected an unsigned integer for '%2$s' parameter"), conf->filename, setting); return -1; } @@ -1332,7 +1332,7 @@ virConfSetValue(virConf *conf, if (*value && (*value)->type == VIR_CONF_STRING && !(*value)->str) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("expecting a value for value of type %s"), + _("expecting a value for value of type %1$s"), virConfTypeToString(VIR_CONF_STRING)); g_clear_pointer(value, virConfFreeValue); return -1; diff --git a/src/util/vircrypto.c b/src/util/vircrypto.c index 12d051a55a..3ce23264ca 100644 --- a/src/util/vircrypto.c +++ b/src/util/vircrypto.c @@ -56,14 +56,14 @@ virCryptoHashBuf(virCryptoHash hash, int rc; if (hash >= VIR_CRYPTO_HASH_LAST) { virReportError(VIR_ERR_INVALID_ARG, - _("Unknown crypto hash %d"), hash); + _("Unknown crypto hash %1$d"), hash); return -1; } rc = gnutls_hash_fast(hashinfo[hash].algorithm, input, strlen(input), output); if (rc < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to compute hash of data: %s"), + _("Unable to compute hash of data: %1$s"), gnutls_strerror(rc)); return -1; } @@ -133,7 +133,7 @@ virCryptoEncryptDataAESgnutls(gnutls_cipher_algorithm_t gnutls_enc_alg, if ((rc = gnutls_cipher_init(&handle, gnutls_enc_alg, &enc_key, &iv_buf)) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("failed to initialize cipher: '%s'"), + _("failed to initialize cipher: '%1$s'"), gnutls_strerror(rc)); return -1; } @@ -160,7 +160,7 @@ virCryptoEncryptDataAESgnutls(gnutls_cipher_algorithm_t gnutls_enc_alg, if (rc < 0) { virSecureErase(ciphertext, ciphertextlen); virReportError(VIR_ERR_INTERNAL_ERROR, - _("failed to encrypt the data: '%s'"), + _("failed to encrypt the data: '%1$s'"), gnutls_strerror(rc)); return -1; } @@ -202,14 +202,14 @@ virCryptoEncryptData(virCryptoCipher algorithm, case VIR_CRYPTO_CIPHER_AES256CBC: if (enckeylen != 32) { virReportError(VIR_ERR_INVALID_ARG, - _("AES256CBC encryption invalid keylen=%zu"), + _("AES256CBC encryption invalid keylen=%1$zu"), enckeylen); return -1; } if (ivlen != 16) { virReportError(VIR_ERR_INVALID_ARG, - _("AES256CBC initialization vector invalid len=%zu"), + _("AES256CBC initialization vector invalid len=%1$zu"), ivlen); return -1; } @@ -230,6 +230,6 @@ virCryptoEncryptData(virCryptoCipher algorithm, } virReportError(VIR_ERR_INVALID_ARG, - _("algorithm=%d is not supported"), algorithm); + _("algorithm=%1$d is not supported"), algorithm); return -1; } diff --git a/src/util/virdaemon.c b/src/util/virdaemon.c index 00bd7095f6..7a288f81e4 100644 --- a/src/util/virdaemon.c +++ b/src/util/virdaemon.c @@ -123,14 +123,14 @@ virDaemonForkIntoBackground(const char *argv0) if (ret != 1) { fprintf(stderr, - _("%s: error: unable to determine if daemon is " - "running: %s\n"), argv0, + _("%1$s: error: unable to determine if daemon is running: %2$s\n"), + argv0, g_strerror(errno)); exit(EXIT_FAILURE); } else if (status != 0) { fprintf(stderr, - _("%s: error: %s. Check /var/log/messages or run without " - "--daemon for more info.\n"), argv0, + _("%1$s: error: %2$s. Check /var/log/messages or run without --daemon for more info.\n"), + argv0, virDaemonErrTypeToString(status)); exit(EXIT_FAILURE); } diff --git a/src/util/virdevmapper.c b/src/util/virdevmapper.c index 7796e7719b..33cf3e202b 100644 --- a/src/util/virdevmapper.c +++ b/src/util/virdevmapper.c @@ -82,7 +82,7 @@ virDevMapperGetMajor(unsigned int *major) if (!lines[i]) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to find major for %s"), + _("Unable to find major for %1$s"), DM_NAME); return -1; } @@ -154,7 +154,7 @@ virDMOpen(void) if (dm.version[0] != DM_VERSION_MAJOR) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, - _("Unsupported device-mapper version. Expected %d got %d"), + _("Unsupported device-mapper version. Expected %1$d got %2$d"), DM_VERSION_MAJOR, dm.version[0]); return -1; } @@ -185,7 +185,7 @@ virDMSanitizepath(const char *path) /* It's a path. Check if the last component is DM name */ if (stat(path, &sb[0]) < 0) { virReportError(errno, - _("Unable to stat %p"), + _("Unable to stat %1$p"), path); return NULL; } @@ -252,7 +252,7 @@ virDevMapperGetTargetsImpl(int controlFD, return 0; virReportSystemError(errno, - _("Unable to query dependencies for %s"), + _("Unable to query dependencies for %1$s"), path); return -1; } diff --git a/src/util/virdnsmasq.c b/src/util/virdnsmasq.c index 342b489ab7..91106b5a28 100644 --- a/src/util/virdnsmasq.c +++ b/src/util/virdnsmasq.c @@ -230,7 +230,7 @@ addnhostsSave(dnsmasqAddnHostsfile *addnhostsfile) addnhostsfile->nhosts); if (err < 0) { - virReportSystemError(-err, _("cannot write config file '%s'"), + virReportSystemError(-err, _("cannot write config file '%1$s'"), addnhostsfile->path); return -1; } @@ -245,7 +245,7 @@ genericFileDelete(char *path) return 0; if (unlink(path) < 0) { - virReportSystemError(errno, _("cannot remove config file '%s'"), + virReportSystemError(errno, _("cannot remove config file '%1$s'"), path); return -1; } @@ -400,7 +400,7 @@ hostsfileSave(dnsmasqHostsfile *hostsfile) hostsfile->nhosts); if (err < 0) { - virReportSystemError(-err, _("cannot write config file '%s'"), + virReportSystemError(-err, _("cannot write config file '%1$s'"), hostsfile->path); return -1; } @@ -509,7 +509,7 @@ dnsmasqSave(const dnsmasqContext *ctx) int ret = 0; if (g_mkdir_with_parents(ctx->config_dir, 0777) < 0) { - virReportSystemError(errno, _("cannot create config directory '%s'"), + virReportSystemError(errno, _("cannot create config directory '%1$s'"), ctx->config_dir); return -1; } @@ -556,8 +556,7 @@ dnsmasqReload(pid_t pid G_GNUC_UNUSED) #ifndef WIN32 if (kill(pid, SIGHUP) != 0) { virReportSystemError(errno, - _("Failed to make dnsmasq (PID: %d)" - " reload config files."), + _("Failed to make dnsmasq (PID: %1$d) reload config files."), pid); return -1; } @@ -617,7 +616,7 @@ dnsmasqCapsSetFromBuffer(dnsmasqCaps *caps, const char *buf) if (version < DNSMASQ_MIN_MAJOR * 1000000 + DNSMASQ_MIN_MINOR * 1000) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("dnsmasq version >= %u.%u required but %lu.%lu found"), + _("dnsmasq version >= %1$u.%2$u required but %3$lu.%4$lu found"), DNSMASQ_MIN_MAJOR, DNSMASQ_MIN_MINOR, version / 1000000, version % 1000000 / 1000); @@ -636,7 +635,7 @@ dnsmasqCapsSetFromBuffer(dnsmasqCaps *caps, const char *buf) else len = p - buf; virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse %s version number in '%.*s'"), + _("cannot parse %1$s version number in '%3$.*2$s'"), caps->binaryPath, len, buf); return -1; diff --git a/src/util/virerror.c b/src/util/virerror.c index d114c0a346..0bfa803b1f 100644 --- a/src/util/virerror.c +++ b/src/util/virerror.c @@ -957,115 +957,115 @@ static const virErrorMsgTuple virErrorMsgStrings[] = { [VIR_ERR_OK] = { NULL, NULL }, [VIR_ERR_INTERNAL_ERROR] = { N_("internal error"), - N_("internal error: %s") }, + N_("internal error: %1$s") }, [VIR_ERR_NO_MEMORY] = { N_("out of memory"), - N_("out of memory: %s") }, + N_("out of memory: %1$s") }, [VIR_ERR_NO_SUPPORT] = { N_("this function is not supported by the connection driver"), - N_("this function is not supported by the connection driver: %s") }, + N_("this function is not supported by the connection driver: %1$s") }, [VIR_ERR_UNKNOWN_HOST] = { N_("unknown host"), - N_("unknown host %s") }, + N_("unknown host %1$s") }, [VIR_ERR_NO_CONNECT] = { N_("no connection driver available"), - N_("no connection driver available for %s") }, + N_("no connection driver available for %1$s") }, [VIR_ERR_INVALID_CONN] = { N_("invalid connection pointer in"), - N_("invalid connection pointer in %s") }, + N_("invalid connection pointer in %1$s") }, [VIR_ERR_INVALID_DOMAIN] = { N_("invalid domain pointer in"), - N_("invalid domain pointer in %s") }, + N_("invalid domain pointer in %1$s") }, [VIR_ERR_INVALID_ARG] = { N_("invalid argument"), - N_("invalid argument: %s") }, + N_("invalid argument: %1$s") }, [VIR_ERR_OPERATION_FAILED] = { N_("operation failed"), - N_("operation failed: %s") }, + N_("operation failed: %1$s") }, [VIR_ERR_GET_FAILED] = { N_("GET operation failed"), - N_("GET operation failed: %s") }, + N_("GET operation failed: %1$s") }, [VIR_ERR_POST_FAILED] = { N_("POST operation failed"), - N_("POST operation failed: %s") }, + N_("POST operation failed: %1$s") }, [VIR_ERR_HTTP_ERROR] = { N_("got unknown HTTP error code"), - N_("got unknown HTTP error code %s") }, + N_("got unknown HTTP error code %1$s") }, [VIR_ERR_SEXPR_SERIAL] = { N_("failed to serialize S-Expr"), - N_("failed to serialize S-Expr: %s") }, + N_("failed to serialize S-Expr: %1$s") }, [VIR_ERR_NO_XEN] = { N_("could not use Xen hypervisor entry"), - N_("could not use Xen hypervisor entry %s") }, + N_("could not use Xen hypervisor entry %1$s") }, [VIR_ERR_XEN_CALL] = { N_("failed Xen syscall"), - N_("failed Xen syscall %s") }, + N_("failed Xen syscall %1$s") }, [VIR_ERR_OS_TYPE] = { N_("unknown OS type"), - N_("unknown OS type %s") }, + N_("unknown OS type %1$s") }, [VIR_ERR_NO_KERNEL] = { N_("missing kernel information"), - N_("missing kernel information: %s") }, + N_("missing kernel information: %1$s") }, [VIR_ERR_NO_ROOT] = { N_("missing root device information"), - N_("missing root device information in %s") }, + N_("missing root device information in %1$s") }, [VIR_ERR_NO_SOURCE] = { N_("missing source information for device"), - N_("missing source information for device %s") }, + N_("missing source information for device %1$s") }, [VIR_ERR_NO_TARGET] = { N_("missing target information for device"), - N_("missing target information for device %s") }, + N_("missing target information for device %1$s") }, [VIR_ERR_NO_NAME] = { N_("missing name information"), - N_("missing name information in %s") }, + N_("missing name information in %1$s") }, [VIR_ERR_NO_OS] = { N_("missing operating system information"), - N_("missing operating system information for %s") }, + N_("missing operating system information for %1$s") }, [VIR_ERR_NO_DEVICE] = { N_("missing devices information"), - N_("missing devices information for %s") }, + N_("missing devices information for %1$s") }, [VIR_ERR_NO_XENSTORE] = { N_("could not connect to Xen Store"), - N_("could not connect to Xen Store %s") }, + N_("could not connect to Xen Store %1$s") }, [VIR_ERR_DRIVER_FULL] = { N_("too many drivers registered"), - N_("too many drivers registered in %s") }, + N_("too many drivers registered in %1$s") }, [VIR_ERR_CALL_FAILED] = { N_("library call failed"), - N_("library call failed: %s") }, + N_("library call failed: %1$s") }, [VIR_ERR_XML_ERROR] = { N_("XML description is invalid or not well formed"), - N_("XML error: %s") }, + N_("XML error: %1$s") }, [VIR_ERR_DOM_EXIST] = { N_("this domain exists already"), - N_("domain %s exists already") }, + N_("domain %1$s exists already") }, [VIR_ERR_OPERATION_DENIED] = { N_("operation forbidden for read only access"), - N_("operation forbidden: %s") }, + N_("operation forbidden: %1$s") }, [VIR_ERR_OPEN_FAILED] = { N_("failed to open configuration file"), - N_("failed to open configuration file %s") }, + N_("failed to open configuration file %1$s") }, [VIR_ERR_READ_FAILED] = { N_("failed to read configuration file"), - N_("failed to read configuration file %s") }, + N_("failed to read configuration file %1$s") }, [VIR_ERR_PARSE_FAILED] = { N_("failed to parse configuration file"), - N_("failed to parse configuration file %s") }, + N_("failed to parse configuration file %1$s") }, [VIR_ERR_CONF_SYNTAX] = { N_("configuration file syntax error"), - N_("configuration file syntax error: %s") }, + N_("configuration file syntax error: %1$s") }, [VIR_ERR_WRITE_FAILED] = { N_("failed to write configuration file"), - N_("failed to write configuration file: %s") }, + N_("failed to write configuration file: %1$s") }, [VIR_ERR_XML_DETAIL] = { N_("parser error"), "%s" }, [VIR_ERR_INVALID_NETWORK] = { N_("invalid network pointer in"), - N_("invalid network pointer in %s") }, + N_("invalid network pointer in %1$s") }, [VIR_ERR_NETWORK_EXIST] = { N_("this network exists already"), - N_("network %s exists already") }, + N_("network %1$s exists already") }, [VIR_ERR_SYSTEM_ERROR] = { N_("system call error"), "%s" }, @@ -1077,214 +1077,214 @@ static const virErrorMsgTuple virErrorMsgStrings[] = { "%s" }, [VIR_WAR_NO_NETWORK] = { N_("Failed to find the network"), - N_("Failed to find the network: %s") }, + N_("Failed to find the network: %1$s") }, [VIR_ERR_NO_DOMAIN] = { N_("Domain not found"), - N_("Domain not found: %s") }, + N_("Domain not found: %1$s") }, [VIR_ERR_NO_NETWORK] = { N_("Network not found"), - N_("Network not found: %s") }, + N_("Network not found: %1$s") }, [VIR_ERR_INVALID_MAC] = { N_("invalid MAC address"), - N_("invalid MAC address: %s") }, + N_("invalid MAC address: %1$s") }, [VIR_ERR_AUTH_FAILED] = { N_("authentication failed"), - N_("authentication failed: %s") }, + N_("authentication failed: %1$s") }, [VIR_ERR_INVALID_STORAGE_POOL] = { N_("invalid storage pool pointer in"), - N_("invalid storage pool pointer in %s") }, + N_("invalid storage pool pointer in %1$s") }, [VIR_ERR_INVALID_STORAGE_VOL] = { N_("invalid storage volume pointer in"), - N_("invalid storage volume pointer in %s") }, + N_("invalid storage volume pointer in %1$s") }, [VIR_WAR_NO_STORAGE] = { N_("Failed to find a storage driver"), - N_("Failed to find a storage driver: %s") }, + N_("Failed to find a storage driver: %1$s") }, [VIR_ERR_NO_STORAGE_POOL] = { N_("Storage pool not found"), - N_("Storage pool not found: %s") }, + N_("Storage pool not found: %1$s") }, [VIR_ERR_NO_STORAGE_VOL] = { N_("Storage volume not found"), - N_("Storage volume not found: %s") }, + N_("Storage volume not found: %1$s") }, [VIR_WAR_NO_NODE] = { N_("Failed to find a node driver"), - N_("Failed to find a node driver: %s") }, + N_("Failed to find a node driver: %1$s") }, [VIR_ERR_INVALID_NODE_DEVICE] = { N_("invalid node device pointer"), - N_("invalid node device pointer in %s") }, + N_("invalid node device pointer in %1$s") }, [VIR_ERR_NO_NODE_DEVICE] = { N_("Node device not found"), - N_("Node device not found: %s") }, + N_("Node device not found: %1$s") }, [VIR_ERR_NO_SECURITY_MODEL] = { N_("Security model not found"), - N_("Security model not found: %s") }, + N_("Security model not found: %1$s") }, [VIR_ERR_OPERATION_INVALID] = { N_("Requested operation is not valid"), - N_("Requested operation is not valid: %s") }, + N_("Requested operation is not valid: %1$s") }, [VIR_WAR_NO_INTERFACE] = { N_("Failed to find the interface"), - N_("Failed to find the interface: %s") }, + N_("Failed to find the interface: %1$s") }, [VIR_ERR_NO_INTERFACE] = { N_("Interface not found"), - N_("Interface not found: %s") }, + N_("Interface not found: %1$s") }, [VIR_ERR_INVALID_INTERFACE] = { N_("invalid interface pointer in"), - N_("invalid interface pointer in %s") }, + N_("invalid interface pointer in %1$s") }, [VIR_ERR_MULTIPLE_INTERFACES] = { N_("multiple matching interfaces found"), - N_("multiple matching interfaces found: %s") }, + N_("multiple matching interfaces found: %1$s") }, [VIR_WAR_NO_NWFILTER] = { N_("Failed to start the nwfilter driver"), - N_("Failed to start the nwfilter driver: %s") }, + N_("Failed to start the nwfilter driver: %1$s") }, [VIR_ERR_INVALID_NWFILTER] = { N_("Invalid network filter"), - N_("Invalid network filter: %s") }, + N_("Invalid network filter: %1$s") }, [VIR_ERR_NO_NWFILTER] = { N_("Network filter not found"), - N_("Network filter not found: %s") }, + N_("Network filter not found: %1$s") }, [VIR_ERR_BUILD_FIREWALL] = { N_("Error while building firewall"), - N_("Error while building firewall: %s") }, + N_("Error while building firewall: %1$s") }, [VIR_WAR_NO_SECRET] = { N_("Failed to find a secret storage driver"), - N_("Failed to find a secret storage driver: %s") }, + N_("Failed to find a secret storage driver: %1$s") }, [VIR_ERR_INVALID_SECRET] = { N_("Invalid secret"), - N_("Invalid secret: %s") }, + N_("Invalid secret: %1$s") }, [VIR_ERR_NO_SECRET] = { N_("Secret not found"), - N_("Secret not found: %s") }, + N_("Secret not found: %1$s") }, [VIR_ERR_CONFIG_UNSUPPORTED] = { N_("unsupported configuration"), - N_("unsupported configuration: %s") }, + N_("unsupported configuration: %1$s") }, [VIR_ERR_OPERATION_TIMEOUT] = { N_("Timed out during operation"), - N_("Timed out during operation: %s") }, + N_("Timed out during operation: %1$s") }, [VIR_ERR_MIGRATE_PERSIST_FAILED] = { N_("Failed to make domain persistent after migration"), - N_("Failed to make domain persistent after migration: %s") }, + N_("Failed to make domain persistent after migration: %1$s") }, [VIR_ERR_HOOK_SCRIPT_FAILED] = { N_("Hook script execution failed"), - N_("Hook script execution failed: %s") }, + N_("Hook script execution failed: %1$s") }, [VIR_ERR_INVALID_DOMAIN_SNAPSHOT] = { N_("Invalid domain snapshot"), - N_("Invalid domain snapshot: %s") }, + N_("Invalid domain snapshot: %1$s") }, [VIR_ERR_NO_DOMAIN_SNAPSHOT] = { N_("Domain snapshot not found"), - N_("Domain snapshot not found: %s") }, + N_("Domain snapshot not found: %1$s") }, [VIR_ERR_INVALID_STREAM] = { N_("invalid stream pointer"), - N_("invalid stream pointer in %s") }, + N_("invalid stream pointer in %1$s") }, [VIR_ERR_ARGUMENT_UNSUPPORTED] = { N_("argument unsupported"), - N_("argument unsupported: %s") }, + N_("argument unsupported: %1$s") }, [VIR_ERR_STORAGE_PROBE_FAILED] = { N_("Storage pool probe failed"), - N_("Storage pool probe failed: %s") }, + N_("Storage pool probe failed: %1$s") }, [VIR_ERR_STORAGE_POOL_BUILT] = { N_("Storage pool already built"), - N_("Storage pool already built: %s") }, + N_("Storage pool already built: %1$s") }, [VIR_ERR_SNAPSHOT_REVERT_RISKY] = { N_("revert requires force"), - N_("revert requires force: %s") }, + N_("revert requires force: %1$s") }, [VIR_ERR_OPERATION_ABORTED] = { N_("operation aborted"), - N_("operation aborted: %s") }, + N_("operation aborted: %1$s") }, [VIR_ERR_AUTH_CANCELLED] = { N_("authentication cancelled"), - N_("authentication cancelled: %s") }, + N_("authentication cancelled: %1$s") }, [VIR_ERR_NO_DOMAIN_METADATA] = { N_("metadata not found"), - N_("metadata not found: %s") }, + N_("metadata not found: %1$s") }, [VIR_ERR_MIGRATE_UNSAFE] = { N_("Unsafe migration"), - N_("Unsafe migration: %s") }, + N_("Unsafe migration: %1$s") }, [VIR_ERR_OVERFLOW] = { N_("numerical overflow"), - N_("numerical overflow: %s") }, + N_("numerical overflow: %1$s") }, [VIR_ERR_BLOCK_COPY_ACTIVE] = { N_("block copy still active"), - N_("block copy still active: %s") }, + N_("block copy still active: %1$s") }, [VIR_ERR_OPERATION_UNSUPPORTED] = { N_("Operation not supported"), - N_("Operation not supported: %s") }, + N_("Operation not supported: %1$s") }, [VIR_ERR_SSH] = { N_("SSH transport error"), - N_("SSH transport error: %s") }, + N_("SSH transport error: %1$s") }, [VIR_ERR_AGENT_UNRESPONSIVE] = { N_("Guest agent is not responding"), - N_("Guest agent is not responding: %s") }, + N_("Guest agent is not responding: %1$s") }, [VIR_ERR_RESOURCE_BUSY] = { N_("resource busy"), - N_("resource busy: %s") }, + N_("resource busy: %1$s") }, [VIR_ERR_ACCESS_DENIED] = { N_("access denied"), - N_("access denied: %s") }, + N_("access denied: %1$s") }, [VIR_ERR_DBUS_SERVICE] = { N_("error from service"), - N_("error from service: %s") }, + N_("error from service: %1$s") }, [VIR_ERR_STORAGE_VOL_EXIST] = { N_("this storage volume exists already"), - N_("storage volume %s exists already") }, + N_("storage volume %1$s exists already") }, [VIR_ERR_CPU_INCOMPATIBLE] = { N_("the CPU is incompatible with host CPU"), - N_("the CPU is incompatible with host CPU: %s") }, + N_("the CPU is incompatible with host CPU: %1$s") }, [VIR_ERR_XML_INVALID_SCHEMA] = { N_("XML document failed to validate against schema"), - N_("XML document failed to validate against schema: %s") }, + N_("XML document failed to validate against schema: %1$s") }, [VIR_ERR_MIGRATE_FINISH_OK] = { N_("migration successfully aborted"), - N_("migration successfully aborted: %s") }, + N_("migration successfully aborted: %1$s") }, [VIR_ERR_AUTH_UNAVAILABLE] = { N_("authentication unavailable"), - N_("authentication unavailable: %s") }, + N_("authentication unavailable: %1$s") }, [VIR_ERR_NO_SERVER] = { N_("Server not found"), - N_("Server not found: %s") }, + N_("Server not found: %1$s") }, [VIR_ERR_NO_CLIENT] = { N_("Client not found"), - N_("Client not found: %s") }, + N_("Client not found: %1$s") }, [VIR_ERR_AGENT_UNSYNCED] = { N_("guest agent replied with wrong id to guest-sync command"), - N_("guest agent replied with wrong id to guest-sync command: %s") }, + N_("guest agent replied with wrong id to guest-sync command: %1$s") }, [VIR_ERR_LIBSSH] = { N_("libssh transport error"), - N_("libssh transport error: %s") }, + N_("libssh transport error: %1$s") }, [VIR_ERR_DEVICE_MISSING] = { N_("device not found"), - N_("device not found: %s") }, + N_("device not found: %1$s") }, [VIR_ERR_INVALID_NWFILTER_BINDING] = { N_("Invalid network filter binding"), - N_("Invalid network filter binding: %s") }, + N_("Invalid network filter binding: %1$s") }, [VIR_ERR_NO_NWFILTER_BINDING] = { N_("Network filter binding not found"), - N_("Network filter binding not found: %s") }, + N_("Network filter binding not found: %1$s") }, [VIR_ERR_INVALID_DOMAIN_CHECKPOINT] = { N_("Invalid domain checkpoint"), - N_("Invalid domain checkpoint: %s") }, + N_("Invalid domain checkpoint: %1$s") }, [VIR_ERR_NO_DOMAIN_CHECKPOINT] = { N_("Domain checkpoint not found"), - N_("Domain checkpoint not found: %s") }, + N_("Domain checkpoint not found: %1$s") }, [VIR_ERR_NO_DOMAIN_BACKUP] = { N_("Domain backup job id not found"), - N_("Domain backup job id not found: %s") }, + N_("Domain backup job id not found: %1$s") }, [VIR_ERR_INVALID_NETWORK_PORT] = { N_("Invalid network port pointer"), - N_("Invalid network port pointer: %s") }, + N_("Invalid network port pointer: %1$s") }, [VIR_ERR_NETWORK_PORT_EXIST] = { N_("this network port exists already"), - N_("network port %s exists already") }, + N_("network port %1$s exists already") }, [VIR_ERR_NO_NETWORK_PORT] = { N_("network port not found"), - N_("network port not found: %s") }, + N_("network port not found: %1$s") }, [VIR_ERR_NO_HOSTNAME] = { N_("no hostname found"), - N_("no hostname found: %s") }, + N_("no hostname found: %1$s") }, [VIR_ERR_CHECKPOINT_INCONSISTENT] = { N_("checkpoint inconsistent"), - N_("checkpoint inconsistent: %s") }, + N_("checkpoint inconsistent: %1$s") }, [VIR_ERR_MULTIPLE_DOMAINS] = { N_("multiple matching domains found"), - N_("multiple matching domains found: %s") }, + N_("multiple matching domains found: %1$s") }, }; G_STATIC_ASSERT(G_N_ELEMENTS(virErrorMsgStrings) == VIR_ERR_NUMBER_LAST); diff --git a/src/util/virerror.h b/src/util/virerror.h index bec3863c3f..ee85247433 100644 --- a/src/util/virerror.h +++ b/src/util/virerror.h @@ -76,7 +76,7 @@ void virReportSystemErrorFull(int domcode, #argname, \ NULL, \ 0, 0, \ - _("%s in %s must be NULL"), \ + _("%1$s in %2$s must be NULL"), \ #argname, __FUNCTION__) #define virReportInvalidNonNullArg(argname) \ virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__, \ @@ -87,7 +87,7 @@ void virReportSystemErrorFull(int domcode, #argname, \ NULL, \ 0, 0, \ - _("%s in %s must not be NULL"), \ + _("%1$s in %2$s must not be NULL"), \ #argname, __FUNCTION__) #define virReportInvalidEmptyStringArg(argname) \ virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__, \ @@ -98,7 +98,7 @@ void virReportSystemErrorFull(int domcode, #argname, \ NULL, \ 0, 0, \ - _("string %s in %s must not be empty"), \ + _("string %1$s in %2$s must not be empty"), \ #argname, __FUNCTION__) #define virReportInvalidPositiveArg(argname) \ virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__, \ @@ -109,7 +109,7 @@ void virReportSystemErrorFull(int domcode, #argname, \ NULL, \ 0, 0, \ - _("%s in %s must be greater than zero"), \ + _("%1$s in %2$s must be greater than zero"), \ #argname, __FUNCTION__) #define virReportInvalidNonZeroArg(argname) \ virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__, \ @@ -120,7 +120,7 @@ void virReportSystemErrorFull(int domcode, #argname, \ NULL, \ 0, 0, \ - _("%s in %s must not be zero"), \ + _("%1$s in %2$s must not be zero"), \ #argname, __FUNCTION__) #define virReportInvalidZeroArg(argname) \ virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__, \ @@ -131,7 +131,7 @@ void virReportSystemErrorFull(int domcode, #argname, \ NULL, \ 0, 0, \ - _("%s in %s must be zero"), \ + _("%1$s in %2$s must be zero"), \ #argname, __FUNCTION__) #define virReportInvalidNonNegativeArg(argname) \ virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__, \ @@ -142,7 +142,7 @@ void virReportSystemErrorFull(int domcode, #argname, \ NULL, \ 0, 0, \ - _("%s in %s must be zero or greater"), \ + _("%1$s in %2$s must be zero or greater"), \ #argname, __FUNCTION__) #define virReportInvalidArg(argname, fmt, ...) \ virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__, \ diff --git a/src/util/vireventthread.c b/src/util/vireventthread.c index 8342f420f6..20d52b9efb 100644 --- a/src/util/vireventthread.c +++ b/src/util/vireventthread.c @@ -162,7 +162,7 @@ virEventThreadStart(virEventThread *evt, const char *name) if (!evt->thread) { virEventThreadDataFree(data); virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to start event thread: %s"), + _("Unable to start event thread: %1$s"), gerr->message); return -1; } diff --git a/tests/virerrortest.c b/tests/virerrortest.c index 85f4071ae8..c1b1a2ba65 100644 --- a/tests/virerrortest.c +++ b/tests/virerrortest.c @@ -29,8 +29,11 @@ virErrorTestMsgFormatInfoOne(const char *msg) char *next; int ret = 0; + if (STREQ(msg, "%s")) + return 0; + for (next = (char *)msg; (next = strchr(next, '%')); next++) { - if (next[1] != 's') { + if (!STRPREFIX(next + 1, "1$s")) { VIR_TEST_VERBOSE("\nerror message '%s' contains disallowed printf modifiers", msg); ret = -1; } else { @@ -44,7 +47,7 @@ virErrorTestMsgFormatInfoOne(const char *msg) } if (!found) { - VIR_TEST_VERBOSE("\nerror message '%s' does not contain any %%s modifiers", msg); + VIR_TEST_VERBOSE("\nerror message '%s' does not contain correct %%s modifiers", msg); ret = -1; }