int ret;
if (virCommandRun(cmd, NULL) < 0) {
- virErrorPtr err = virGetLastError();
- printf("Cannot run child %s\n", err->message);
+ printf("Cannot run child %s\n", virGetLastErrorMessage());
virCommandFree(cmd);
return -1;
}
}
if (virCommandRun(cmd, NULL) < 0) {
- virErrorPtr err = virGetLastError();
- printf("Cannot run child %s\n", err->message);
+ printf("Cannot run child %s\n", virGetLastErrorMessage());
virCommandFree(cmd);
return -1;
}
VIR_COMMAND_PASS_FD_CLOSE_PARENT);
if (virCommandRun(cmd, NULL) < 0) {
- virErrorPtr err = virGetLastError();
- printf("Cannot run child %s\n", err->message);
+ printf("Cannot run child %s\n", virGetLastErrorMessage());
goto cleanup;
}
virCommandDaemonize(cmd);
if (virCommandRun(cmd, NULL) < 0) {
- virErrorPtr err = virGetLastError();
- printf("Cannot run child %s\n", err->message);
+ printf("Cannot run child %s\n", virGetLastErrorMessage());
goto cleanup;
}
virCommandAddEnvPassCommon(cmd);
if (virCommandRun(cmd, NULL) < 0) {
- virErrorPtr err = virGetLastError();
- printf("Cannot run child %s\n", err->message);
+ printf("Cannot run child %s\n", virGetLastErrorMessage());
virCommandFree(cmd);
return -1;
}
virCommandAddEnvPassBlockSUID(cmd, "DOESNOTEXIST", NULL);
if (virCommandRun(cmd, NULL) < 0) {
- virErrorPtr err = virGetLastError();
- printf("Cannot run child %s\n", err->message);
+ printf("Cannot run child %s\n", virGetLastErrorMessage());
virCommandFree(cmd);
return -1;
}
virCommandAddEnvPassBlockSUID(cmd, "DOESNOTEXIST", NULL);
if (virCommandRun(cmd, NULL) < 0) {
- virErrorPtr err = virGetLastError();
- printf("Cannot run child %s\n", err->message);
+ printf("Cannot run child %s\n", virGetLastErrorMessage());
virCommandFree(cmd);
return -1;
}
virCommandAddEnvPair(cmd, "USER", "test");
if (virCommandRun(cmd, NULL) < 0) {
- virErrorPtr err = virGetLastError();
- printf("Cannot run child %s\n", err->message);
+ printf("Cannot run child %s\n", virGetLastErrorMessage());
virCommandFree(cmd);
return -1;
}
}
if (virCommandRun(cmd, NULL) < 0) {
- virErrorPtr err = virGetLastError();
- printf("Cannot run child %s\n", err->message);
+ printf("Cannot run child %s\n", virGetLastErrorMessage());
virCommandFree(cmd);
return -1;
}
virCommandAddArgSet(cmd, args);
if (virCommandRun(cmd, NULL) < 0) {
- virErrorPtr err = virGetLastError();
- printf("Cannot run child %s\n", err->message);
+ printf("Cannot run child %s\n", virGetLastErrorMessage());
virCommandFree(cmd);
return -1;
}
virCommandPtr cmd = virCommandNewArgs(args);
if (virCommandRun(cmd, NULL) < 0) {
- virErrorPtr err = virGetLastError();
- printf("Cannot run child %s\n", err->message);
+ printf("Cannot run child %s\n", virGetLastErrorMessage());
virCommandFree(cmd);
return -1;
}
virCommandSetInputBuffer(cmd, "Hello World\n");
if (virCommandRun(cmd, NULL) < 0) {
- virErrorPtr err = virGetLastError();
- printf("Cannot run child %s\n", err->message);
+ printf("Cannot run child %s\n", virGetLastErrorMessage());
virCommandFree(cmd);
return -1;
}
virCommandSetOutputBuffer(cmd, &outactual);
if (virCommandRun(cmd, NULL) < 0) {
- virErrorPtr err = virGetLastError();
- printf("Cannot run child %s\n", err->message);
+ printf("Cannot run child %s\n", virGetLastErrorMessage());
goto cleanup;
}
if (!outactual)
virCommandSetErrorBuffer(cmd, &erractual);
if (virCommandRun(cmd, NULL) < 0) {
- virErrorPtr err = virGetLastError();
- printf("Cannot run child %s\n", err->message);
+ printf("Cannot run child %s\n", virGetLastErrorMessage());
goto cleanup;
}
if (!outactual || !erractual)
virCommandSetOutputBuffer(cmd, &jointactual);
virCommandSetErrorBuffer(cmd, &jointactual);
if (virCommandRun(cmd, NULL) < 0) {
- virErrorPtr err = virGetLastError();
- printf("Cannot run child %s\n", err->message);
+ printf("Cannot run child %s\n", virGetLastErrorMessage());
goto cleanup;
}
if (!jointactual)
virCommandSetUmask(cmd, 002);
if (virCommandRun(cmd, NULL) < 0) {
- virErrorPtr err = virGetLastError();
- printf("Cannot run child %s\n", err->message);
+ printf("Cannot run child %s\n", virGetLastErrorMessage());
goto cleanup;
}
virCommandAddArg(cmd, "G H");
if ((outactual = virCommandToString(cmd)) == NULL) {
- virErrorPtr err = virGetLastError();
- printf("Cannot convert to string: %s\n", err->message);
+ printf("Cannot convert to string: %s\n", virGetLastErrorMessage());
goto cleanup;
}
if ((fd = open(abs_builddir "/commandhelper.log",
}
if (virCommandRun(cmd, NULL) < 0) {
- virErrorPtr err = virGetLastError();
- printf("Cannot run child %s\n", err->message);
+ printf("Cannot run child %s\n", virGetLastErrorMessage());
goto cleanup;
}
}
if (virCommandRun(cmd, NULL) < 0) {
- virErrorPtr err = virGetLastError();
- printf("Cannot run child %s\n", err->message);
+ printf("Cannot run child %s\n", virGetLastErrorMessage());
goto cleanup;
}
alarm(5);
if (virCommandRun(cmd, NULL) < 0) {
- virErrorPtr err = virGetLastError();
- printf("Cannot run child %s\n", err->message);
+ printf("Cannot run child %s\n", virGetLastErrorMessage());
goto cleanup;
}
alarm(0);
alarm(5);
if (virCommandRunAsync(cmd, &pid) < 0) {
- virErrorPtr err = virGetLastError();
- printf("Cannot run child %s\n", err->message);
+ printf("Cannot run child %s\n", virGetLastErrorMessage());
goto cleanup;
}
virCommandSetInputBuffer(cmd, buf);
if (virCommandRun(cmd, NULL) < 0) {
- virErrorPtr err = virGetLastError();
- printf("Cannot run child %s\n", err->message);
+ printf("Cannot run child %s\n", virGetLastErrorMessage());
goto cleanup;
}
virCommandDoAsyncIO(cmd);
if (virCommandRunAsync(cmd, NULL) < 0) {
- virErrorPtr err = virGetLastError();
- printf("Cannot run child %s\n", err->message);
+ printf("Cannot run child %s\n", virGetLastErrorMessage());
goto cleanup;
}
cmd = virCommandNewArgList("/bin/sh", "-c", "exit 3", NULL);
if (virCommandRun(cmd, &status) < 0) {
- virErrorPtr err = virGetLastError();
- printf("Cannot run child %s\n", err->message);
+ printf("Cannot run child %s\n", virGetLastErrorMessage());
goto cleanup;
}
if (status != 3) {
virCommandRawStatus(cmd);
if (virCommandRun(cmd, &status) < 0) {
- virErrorPtr err = virGetLastError();
- printf("Cannot run child %s\n", err->message);
+ printf("Cannot run child %s\n", virGetLastErrorMessage());
goto cleanup;
}
if (!WIFEXITED(status) || WEXITSTATUS(status) != 3) {
virCommandRawStatus(cmd);
if (virCommandRun(cmd, &status) < 0) {
- virErrorPtr err = virGetLastError();
- printf("Cannot run child %s\n", err->message);
+ printf("Cannot run child %s\n", virGetLastErrorMessage());
goto cleanup;
}
if (!WIFSIGNALED(status) || WTERMSIG(status) != SIGKILL) {
virCommandPassListenFDs(cmd);
if (virCommandRun(cmd, NULL) < 0) {
- virErrorPtr err = virGetLastError();
- printf("Cannot run child %s\n", err->message);
+ printf("Cannot run child %s\n", virGetLastErrorMessage());
goto cleanup;
}
data->params,
data->paramnum,
&type);
- virErrorPtr err = NULL;
+ const char *err = NULL;
if (!newdata)
return -1;
goto cleanup;
}
- err = virGetLastError();
- if (!err || !err->message) {
+ err = virGetLastErrorMessage();
+ if (!err) {
VIR_DEBUG("No error or message %p", err);
ret = -1;
goto cleanup;
}
#if !WITH_SASL
- if (strstr(err->message, "unsupported auth sasl")) {
+ if (strstr(err, "unsupported auth sasl")) {
VIR_DEBUG("sasl unsupported, skipping this config");
goto cleanup;
}
switch (type) {
case VIR_CONF_ULONG:
- if (!strstr(err->message, "invalid type: got string; expected unsigned long") &&
- !strstr(err->message, "invalid type: got string; expected long")) {
+ if (!strstr(err, "invalid type: got string; expected unsigned long") &&
+ !strstr(err, "invalid type: got string; expected long")) {
VIR_DEBUG("Wrong error for long: '%s'",
- err->message);
+ err);
ret = -1;
}
break;
case VIR_CONF_STRING:
- if (!strstr(err->message, "invalid type: got unsigned long; expected string")) {
+ if (!strstr(err, "invalid type: got unsigned long; expected string")) {
VIR_DEBUG("Wrong error for string: '%s'",
- err->message);
+ err);
ret = -1;
}
break;
case VIR_CONF_LIST:
- if (!strstr(err->message, "must be a string or list of strings")) {
+ if (!strstr(err, "must be a string or list of strings")) {
VIR_DEBUG("Wrong error for list: '%s'",
- err->message);
+ err);
ret = -1;
}
break;
}
if (virFileReadAll(filename, 1024*1024, &filedata) < 0) {
- virErrorPtr err = virGetLastError();
- fprintf(stderr, "Cannot load %s for testing: %s", filename, err->message);
+ const char *err = virGetLastErrorMessage();
+ fprintf(stderr, "Cannot load %s for testing: %s", filename, err);
ret = -1;
goto cleanup;
}