[Pkg-libvirt-maintainers] Bug#492250: Doesn't check properly on an open() failure

Guido Trotter ultrotter at debian.org
Thu Jul 24 16:48:42 UTC 2008


Package: libvirt
Version: 0.4.2-6
Severity: normal
Tags: patch

Hi,

libvirt 0.4.2-6 and 0.4.4-2 have a bug in checking for open() failures:

at line 482 of qemu_driver.c:

    if (!(monfd = open(monitor, O_RDWR))) {
        qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                         _("Unable to open monitor path %s"), monitor);
        return -1;
    }

If open fails open() will return -1, and monfd having a non-zero value will be
true, thus the failure won't be detected. This will translate in another error
later. The solution is to use:

    if ((monfd = open(monitor, O_RDWR)) < 0) {


Thanks,

Guido

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (1001, 'testing'), (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26.0rx01 (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=en_IE.UTF-8, LC_CTYPE=en_IE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash





More information about the Pkg-libvirt-maintainers mailing list