dmn);
} else {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unexpected server name '%s' during restart"),
+ _("Unexpected server name '%1$s' during restart"),
name);
return NULL;
}
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;
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;
}
fprintf(stderr,
_("\n"
"Usage:\n"
- " %s [options]\n"
+ " %1$s [options]\n"
"\n"
"Options:\n"
" -h | --help Display program help:\n"
" Default paths:\n"
"\n"
" Configuration file (unless overridden by -f):\n"
- " %s/libvirt/virtlockd.conf\n"
+ " %1$s/libvirt/virtlockd.conf\n"
"\n"
" Sockets:\n"
- " %s/libvirt/virtlockd-sock\n"
+ " %2$s/libvirt/virtlockd-sock\n"
"\n"
" PID file (unless overridden by -p):\n"
- " %s/virtlockd.pid\n"
+ " %3$s/virtlockd.pid\n"
"\n"),
SYSCONFDIR,
RUNSTATEDIR,
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);
}
/* Read the config file if it exists */
if (remote_config_file &&
virLockDaemonConfigLoadFile(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);
}
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);
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;
}
#if WITH_SANLOCK_STRERROR
*message = g_strdup(sanlock_strerror(err));
#else
- *message = g_strdup_printf(_("sanlock error %d"), err);
+ *message = g_strdup_printf(_("sanlock error %1$d"), err);
#endif
return true;
} else {
if (access(configFile, R_OK) == -1) {
if (errno != ENOENT) {
virReportSystemError(errno,
- _("Unable to access config file %s"),
+ _("Unable to access config file %1$s"),
configFile);
return -1;
}
if (virStrcpyStatic(ls.name,
VIR_LOCK_MANAGER_SANLOCK_AUTO_DISK_LOCKSPACE) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Lockspace path '%s' exceeded %d characters"),
+ _("Lockspace path '%1$s' exceeded %2$d characters"),
VIR_LOCK_MANAGER_SANLOCK_AUTO_DISK_LOCKSPACE,
SANLK_PATH_LEN);
goto error;
ls.flags = 0;
if (virStrcpy(ls.host_id_disk.path, path, SANLK_PATH_LEN) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Lockspace path '%s' exceeded %d characters"),
+ _("Lockspace path '%1$s' exceeded %2$d characters"),
path, SANLK_PATH_LEN);
goto error;
}
dir = g_path_get_dirname(path);
if (stat(dir, &st) < 0 || !S_ISDIR(st.st_mode)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unable to create lockspace %s: parent directory"
- " does not exist or is not a directory"),
+ _("Unable to create lockspace %1$s: parent directory does not exist or is not a directory"),
path);
goto error;
}
if ((fd = open(path, O_WRONLY|O_CREAT|O_EXCL, perms)) < 0) {
if (errno != EEXIST) {
virReportSystemError(errno,
- _("Unable to create lockspace %s"),
+ _("Unable to create lockspace %1$s"),
path);
goto error;
}
if ((driver->user != (uid_t) -1 || driver->group != (gid_t) -1) &&
(fchown(fd, driver->user, driver->group) < 0)) {
virReportSystemError(errno,
- _("cannot chown '%s' to (%u, %u)"),
+ _("cannot chown '%1$s' to (%2$u, %3$u)"),
path,
(unsigned int) driver->user,
(unsigned int) driver->group);
char *err = NULL;
if (virLockManagerSanlockError(rv, &err)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unable to query sector size %s: %s"),
+ _("Unable to query sector size %1$s: %2$s"),
path, NULLSTR(err));
VIR_FREE(err);
} else {
virReportSystemError(-rv,
- _("Unable to query sector size %s"),
+ _("Unable to query sector size %1$s"),
path);
}
goto error_unlink;
*/
if (safezero(fd, 0, rv) < 0) {
virReportSystemError(errno,
- _("Unable to allocate lockspace %s"),
+ _("Unable to allocate lockspace %1$s"),
path);
goto error_unlink;
}
if (VIR_CLOSE(fd) < 0) {
virReportSystemError(errno,
- _("Unable to save lockspace %s"),
+ _("Unable to save lockspace %1$s"),
path);
goto error_unlink;
}
char *err = NULL;
if (virLockManagerSanlockError(rv, &err)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unable to initialize lockspace %s: %s"),
+ _("Unable to initialize lockspace %1$s: %2$s"),
path, NULLSTR(err));
VIR_FREE(err);
} else {
virReportSystemError(-rv,
- _("Unable to initialize lockspace %s"),
+ _("Unable to initialize lockspace %1$s"),
path);
}
goto error_unlink;
(driver->group != (gid_t) -1 && driver->group != st.st_gid)) &&
(chown(path, driver->user, driver->group) < 0)) {
virReportSystemError(errno,
- _("cannot chown '%s' to (%u, %u)"),
+ _("cannot chown '%1$s' to (%2$u, %3$u)"),
path,
(unsigned int) driver->user,
(unsigned int) driver->group);
if ((driver->group != (gid_t) -1 && (st.st_mode & 0060) != 0060) &&
chmod(path, 0660) < 0) {
virReportSystemError(errno,
- _("cannot chmod '%s' to 0660"),
+ _("cannot chmod '%1$s' to 0660"),
path);
goto error;
}
char *err = NULL;
if (virLockManagerSanlockError(rv, &err)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unable to add lockspace %s: %s"),
+ _("Unable to add lockspace %1$s: %2$s"),
path, NULLSTR(err));
VIR_FREE(err);
} else {
virReportSystemError(-rv,
- _("Unable to add lockspace %s"),
+ _("Unable to add lockspace %1$s"),
path);
}
goto error;
if (type != VIR_LOCK_MANAGER_OBJECT_TYPE_DOMAIN) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unsupported object type %d"), type);
+ _("Unsupported object type %1$d"), type);
return -1;
}
res->num_disks = 1;
if (virStrcpy(res->name, name, SANLK_NAME_LEN) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Resource name '%s' exceeds %d characters"),
+ _("Resource name '%1$s' exceeds %2$d characters"),
name, SANLK_NAME_LEN);
return -1;
}
if (STREQ(params[i].key, "path")) {
if (virStrcpy(res->disks[0].path, params[i].value.str, SANLK_PATH_LEN) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Lease path '%s' exceeds %d characters"),
+ _("Lease path '%1$s' exceeds %2$d characters"),
params[i].value.str, SANLK_PATH_LEN);
return -1;
}
} else if (STREQ(params[i].key, "lockspace")) {
if (virStrcpy(res->lockspace_name, params[i].value.str, SANLK_NAME_LEN) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Resource lockspace '%s' exceeds %d characters"),
+ _("Resource lockspace '%1$s' exceeds %2$d characters"),
params[i].value.str, SANLK_NAME_LEN);
return -1;
}
return -1;
if (virStrcpy(res->name, hash, SANLK_NAME_LEN) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("MD5 hash '%s' unexpectedly larger than %d characters"),
+ _("MD5 hash '%1$s' unexpectedly larger than %2$d characters"),
hash, (SANLK_NAME_LEN - 1));
return -1;
}
path = g_strdup_printf("%s/%s", driver->autoDiskLeasePath, res->name);
if (virStrcpy(res->disks[0].path, path, SANLK_PATH_LEN) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Lease path '%s' exceeds %d characters"),
+ _("Lease path '%1$s' exceeds %2$d characters"),
path, SANLK_PATH_LEN);
return -1;
}
VIR_LOCK_MANAGER_SANLOCK_AUTO_DISK_LOCKSPACE,
SANLK_NAME_LEN) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Resource lockspace '%s' exceeds %d characters"),
+ _("Resource lockspace '%1$s' exceeds %2$d characters"),
VIR_LOCK_MANAGER_SANLOCK_AUTO_DISK_LOCKSPACE, SANLK_NAME_LEN);
return -1;
}
if ((fd = open(res->disks[0].path, O_WRONLY|O_CREAT|O_EXCL, 0600)) < 0) {
if (errno != EEXIST) {
virReportSystemError(errno,
- _("Unable to create lockspace %s"),
+ _("Unable to create lockspace %1$s"),
res->disks[0].path);
return -1;
}
if ((driver->user != (uid_t) -1 || driver->group != (gid_t) -1) &&
(fchown(fd, driver->user, driver->group) < 0)) {
virReportSystemError(errno,
- _("cannot chown '%s' to (%u, %u)"),
+ _("cannot chown '%1$s' to (%2$u, %3$u)"),
res->disks[0].path,
(unsigned int) driver->user,
(unsigned int) driver->group);
char *err = NULL;
if (virLockManagerSanlockError(rv, &err)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unable to query sector size %s: %s"),
+ _("Unable to query sector size %1$s: %2$s"),
res->disks[0].path, NULLSTR(err));
VIR_FREE(err);
} else {
virReportSystemError(-rv,
- _("Unable to query sector size %s"),
+ _("Unable to query sector size %1$s"),
res->disks[0].path);
}
goto error_unlink;
*/
if (safezero(fd, 0, rv) < 0) {
virReportSystemError(errno,
- _("Unable to allocate lease %s"),
+ _("Unable to allocate lease %1$s"),
res->disks[0].path);
goto error_unlink;
}
if (VIR_CLOSE(fd) < 0) {
virReportSystemError(errno,
- _("Unable to save lease %s"),
+ _("Unable to save lease %1$s"),
res->disks[0].path);
goto error_unlink;
}
char *err = NULL;
if (virLockManagerSanlockError(rv, &err)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unable to initialize lease %s: %s"),
+ _("Unable to initialize lease %1$s: %2$s"),
res->disks[0].path, NULLSTR(err));
VIR_FREE(err);
} else {
virReportSystemError(-rv,
- _("Unable to initialize lease %s"),
+ _("Unable to initialize lease %1$s"),
res->disks[0].path);
}
goto error_unlink;
if (priv->res_count == SANLK_MAX_RESOURCES) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Too many resources %d for object"),
+ _("Too many resources %1$d for object"),
SANLK_MAX_RESOURCES);
return -1;
}
default:
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unknown lock manager object type %d for domain lock object"),
+ _("Unknown lock manager object type %1$d for domain lock object"),
type);
return -1;
}
case VIR_DOMAIN_LOCK_FAILURE_IGNORE:
case VIR_DOMAIN_LOCK_FAILURE_LAST:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Failure action %s is not supported by sanlock"),
+ _("Failure action %1$s is not supported by sanlock"),
virDomainLockFailureTypeToString(action));
return -1;
}
/* sanlock_killpath() would just crop the strings */
if (strlen(path) >= SANLK_HELPER_PATH_LEN) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Sanlock helper path is longer than %d: '%s'"),
+ _("Sanlock helper path is longer than %1$d: '%2$s'"),
SANLK_HELPER_PATH_LEN - 1, path);
return -1;
}
if (strlen(args) >= SANLK_HELPER_ARGS_LEN) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Sanlock helper arguments are longer than %d:"
- " '%s'"),
+ _("Sanlock helper arguments are longer than %1$d: '%2$s'"),
SANLK_HELPER_ARGS_LEN - 1, args);
return -1;
}
char *err = NULL;
if (virLockManagerSanlockError(rv, &err)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to register lock failure action: %s"),
+ _("Failed to register lock failure action: %1$s"),
NULLSTR(err));
VIR_FREE(err);
} else {
char *err = NULL;
if (virLockManagerSanlockError(sock, &err)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to open socket to sanlock daemon: %s"),
+ _("Failed to open socket to sanlock daemon: %1$s"),
NULLSTR(err));
VIR_FREE(err);
} else {
char *err = NULL;
if (virLockManagerSanlockError(rv, &err)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unable to parse lock state %s: %s"),
+ _("Unable to parse lock state %1$s: %2$s"),
state, NULLSTR(err));
VIR_FREE(err);
} else {
virReportSystemError(-rv,
- _("Unable to parse lock state %s"),
+ _("Unable to parse lock state %1$s"),
state);
}
goto error;
char *err = NULL;
if (virLockManagerSanlockError(rv, &err)) {
virReportError(VIR_ERR_RESOURCE_BUSY,
- _("Failed to acquire lock: %s"),
+ _("Failed to acquire lock: %1$s"),
NULLSTR(err));
VIR_FREE(err);
} else {
char *err = NULL;
if (virLockManagerSanlockError(rv, &err)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to restrict process: %s"),
+ _("Failed to restrict process: %1$s"),
NULLSTR(err));
VIR_FREE(err);
} else {
char *err = NULL;
if (virLockManagerSanlockError(rv, &err)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to inquire lock: %s"),
+ _("Failed to inquire lock: %1$s"),
NULLSTR(err));
VIR_FREE(err);
} else {
char *err = NULL;
if (virLockManagerSanlockError(rv, &err)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to release lock: %s"),
+ _("Failed to release lock: %1$s"),
NULLSTR(err));
VIR_FREE(err);
} else {
char *err;
if (virLockManagerSanlockError(rv, &err)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to inquire lock: %s"),
+ _("Failed to inquire lock: %1$s"),
NULLSTR(err));
VIR_FREE(err);
} else {