qemu: process: report useful error if alias formatting fails

When retrieving the paths for PTY devices the alias gets formatted into
a static string. If it doesn't fit we wouldn't report an error.
This commit is contained in:
Peter Krempa 2014-11-13 20:10:51 +01:00
parent 507ea951c7
commit 6692ba731b

View File

@ -1879,8 +1879,12 @@ qemuProcessLookupPTYs(virDomainDefPtr def,
if (snprintf(id, sizeof(id), "%s%s",
chardevfmt ? "char" : "",
chr->info.alias) >= sizeof(id))
chr->info.alias) >= sizeof(id)) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("failed to format device alias "
"for PTY retrieval"));
return -1;
}
path = (const char *) virHashLookup(paths, id);
if (path == NULL) {