mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-11-06 05:11:14 +00:00
69b9fcf297
* tests/conftest.c: Use fwrite, not printf, since the result buffer is not NUL-terminatedi, from Jim Meyering. * tests/qemuxml2argvtest.c: Initialize vm.migrateFrom[0], to avoid "read-uninitialized" error from within qemudBuildCommandLinei, from Jim Meyering. Daniel
34 lines
725 B
C
34 lines
725 B
C
#include <unistd.h>
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include "conf.h"
|
|
|
|
int main(int argc, char **argv) {
|
|
int ret;
|
|
virConfPtr conf;
|
|
int len = 10000;
|
|
char buffer[10000];
|
|
|
|
if (argc != 2) {
|
|
fprintf(stderr, "Usage: %s conf_file\n", argv[0]);
|
|
exit(1);
|
|
}
|
|
|
|
conf = virConfReadFile(argv[1]);
|
|
if (conf == NULL) {
|
|
fprintf(stderr, "Failed to process %s\n", argv[1]);
|
|
exit(2);
|
|
}
|
|
ret = virConfWriteMem(&buffer[0], &len, conf);
|
|
if (ret < 0) {
|
|
fprintf(stderr, "Failed to serialize %s back\n", argv[1]);
|
|
exit(3);
|
|
}
|
|
virConfFree(conf);
|
|
if (fwrite(buffer, len, 1, stdout) != len) {
|
|
fprintf(stderr, "Write failed\n");
|
|
exit(1);
|
|
}
|
|
exit(0);
|
|
}
|