diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 9ecad51489..eac6553bc8 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -1431,45 +1431,22 @@ cleanup: * * char device redirected to /dev/pts/3 * - * However, since 1.4 the line we are looking for has changed to: - * - * char device redirected to /some/path - * * Returns -1 for error, 0 success, 1 continue reading */ static int qemuProcessExtractTTYPath(const char *haystack, size_t *offset, - const char *alias, char **path) { - static const char *needle[] = {"char device", "redirected to"}; - const char *tmp, *dev; + static const char needle[] = "char device redirected to"; + char *tmp, *dev; VIR_FREE(*path); /* First look for our magic string */ - if (!(tmp = strstr(haystack + *offset, needle[0]))) + if (!(tmp = strstr(haystack + *offset, needle))) { return 1; - - tmp += strlen(needle[0]); - virSkipSpaces(&tmp); - - /* We prepend character devices IDs with 'char' prefix, - * hence full device ID is 'charalias0' */ - if (STRPREFIX(tmp, "char")) { - /* we are dealing with new style */ - tmp += strlen("char"); - if (!STRPREFIX(tmp, alias)) - return 1; - - tmp += strlen(alias); - virSkipSpaces(&tmp); } - - if (!STRPREFIX(tmp, needle[1])) - return 1; - - tmp += strlen(needle[1]); + tmp += sizeof(needle); dev = tmp; /* @@ -1592,7 +1569,6 @@ qemuProcessFindCharDevicePTYs(virDomainObjPtr vm, virDomainChrDefPtr chr = vm->def->serials[i]; if (chr->source.type == VIR_DOMAIN_CHR_TYPE_PTY) { if ((ret = qemuProcessExtractTTYPath(output, &offset, - chr->info.alias, &chr->source.data.file.path)) != 0) return ret; } @@ -1603,7 +1579,6 @@ qemuProcessFindCharDevicePTYs(virDomainObjPtr vm, virDomainChrDefPtr chr = vm->def->parallels[i]; if (chr->source.type == VIR_DOMAIN_CHR_TYPE_PTY) { if ((ret = qemuProcessExtractTTYPath(output, &offset, - chr->info.alias, &chr->source.data.file.path)) != 0) return ret; } @@ -1614,7 +1589,6 @@ qemuProcessFindCharDevicePTYs(virDomainObjPtr vm, virDomainChrDefPtr chr = vm->def->channels[i]; if (chr->source.type == VIR_DOMAIN_CHR_TYPE_PTY) { if ((ret = qemuProcessExtractTTYPath(output, &offset, - chr->info.alias, &chr->source.data.file.path)) != 0) return ret; } @@ -1634,7 +1608,6 @@ qemuProcessFindCharDevicePTYs(virDomainObjPtr vm, if (chr->source.type == VIR_DOMAIN_CHR_TYPE_PTY && chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO) { if ((ret = qemuProcessExtractTTYPath(output, &offset, - chr->info.alias, &chr->source.data.file.path)) != 0) return ret; }