char **adminSockfile)
{
if (privileged) {
- if (VIR_STRDUP(*sockfile, RUNSTATEDIR "/libvirt/virtlogd-sock") < 0 ||
- VIR_STRDUP(*adminSockfile, RUNSTATEDIR "/libvirt/virtlogd-admin-sock") < 0)
- goto error;
+ *sockfile = g_strdup(RUNSTATEDIR "/libvirt/virtlogd-sock");
+ *adminSockfile = g_strdup(RUNSTATEDIR "/libvirt/virtlogd-admin-sock");
} else {
char *rundir = NULL;
mode_t old_umask;
char **state_file)
{
if (privileged) {
- if (VIR_STRDUP(*state_file, RUNSTATEDIR "/virtlogd-restart-exec.json") < 0)
- goto error;
+ *state_file = g_strdup(RUNSTATEDIR "/virtlogd-restart-exec.json");
} else {
char *rundir = NULL;
mode_t old_umask;
case 'p':
VIR_FREE(pid_file);
- if (VIR_STRDUP_QUIET(pid_file, optarg) < 0)
- goto no_memory;
+ pid_file = g_strdup(optarg);
break;
case 'f':
VIR_FREE(remote_config_file);
- if (VIR_STRDUP_QUIET(remote_config_file, optarg) < 0)
- goto no_memory;
+ remote_config_file = g_strdup(optarg);
break;
case 'V':
/* Ensure the rundir exists (on tmpfs on some systems) */
if (privileged) {
- if (VIR_STRDUP_QUIET(run_dir, RUNSTATEDIR "/libvirt") < 0)
- goto no_memory;
+ run_dir = g_strdup(RUNSTATEDIR "/libvirt");
} else {
if (!(run_dir = virGetUserRuntimeDirectory())) {
VIR_ERROR(_("Can't determine user directory"));
VIR_FREE(remote_config_file);
virLogDaemonConfigFree(config);
return ret;
-
- no_memory:
- VIR_ERROR(_("Can't allocate memory"));
- exit(EXIT_FAILURE);
}
virLogDaemonConfigFilePath(bool privileged, char **configfile)
{
if (privileged) {
- if (VIR_STRDUP(*configfile, SYSCONFDIR "/libvirt/virtlogd.conf") < 0)
- goto error;
+ *configfile = g_strdup(SYSCONFDIR "/libvirt/virtlogd.conf");
} else {
char *configdir = NULL;
_("Missing 'driver' in JSON document"));
goto error;
}
- if (VIR_STRDUP(file->driver, tmp) < 0)
- goto error;
+ file->driver = g_strdup(tmp);
if ((tmp = virJSONValueObjectGetString(object, "domname")) == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Missing 'domname' in JSON document"));
goto error;
}
- if (VIR_STRDUP(file->domname, tmp) < 0)
- goto error;
+ file->domname = g_strdup(tmp);
if ((domuuid = virJSONValueObjectGetString(object, "domuuid")) == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
file->pipefd = pipefd[0];
pipefd[0] = -1;
memcpy(file->domuuid, domuuid, VIR_UUID_BUFLEN);
- if (VIR_STRDUP(file->driver, driver) < 0 ||
- VIR_STRDUP(file->domname, domname) < 0)
- goto error;
+ file->driver = g_strdup(driver);
+ file->domname = g_strdup(domname);
if ((file->file = virRotatingFileWriterNew(path,
handler->max_size,
{
char *path;
if (privileged) {
- if (VIR_STRDUP(path, RUNSTATEDIR "/libvirt/virtlogd-sock") < 0)
- return NULL;
+ path = g_strdup(RUNSTATEDIR "/libvirt/virtlogd-sock");
} else {
char *rundir = NULL;