From: Shivaprasad G Bhat Date: Sun, 31 May 2015 15:55:59 +0000 (+0530) Subject: check if console/channel PTY is null before attempting to open X-Git-Tag: v1.2.17-rc1~287 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eac9445e40c47e4b2c2dfeceb6136234ca6505fa;p=thirdparty%2Flibvirt.git check if console/channel PTY is null before attempting to open Console/channel devices have their pty devices assigned when the emulator is actually started. If time is spent in guest preparation, someone attempts to open the console/channel, the libvirt crashes in virChrdevLockFilePath(). The patch attempts to fix the crash by adding a check before attempting to open. Signed-off-by: Shivaprasad G Bhat --- diff --git a/src/conf/virchrdev.c b/src/conf/virchrdev.c index 5f28f2978b..701b326fb2 100644 --- a/src/conf/virchrdev.c +++ b/src/conf/virchrdev.c @@ -350,6 +350,11 @@ int virChrdevOpen(virChrdevsPtr devs, switch (source->type) { case VIR_DOMAIN_CHR_TYPE_PTY: path = source->data.file.path; + if (!path) { + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("PTY device is not yet assigned")); + return -1; + } break; case VIR_DOMAIN_CHR_TYPE_UNIX: path = source->data.nix.path;