From 6692ba731bc4ec79564fc8efd46443be26ff223c Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Thu, 13 Nov 2014 20:10:51 +0100 Subject: [PATCH] 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. --- src/qemu/qemu_process.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 1f22bd012a..9bf2ed36d2 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -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) { -- GitLab