Switch to 'VIR_AUTOCLOSE' to simplify cleanup.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
char *buf,
size_t buflen)
{
- int fd = -1;
- int ret;
+ VIR_AUTOCLOSE fd = -1;
if ((fd = open(logfile, O_RDONLY)) < 0) {
virReportSystemError(errno,
virReportSystemError(errno,
_("Unable to seek log file %s to %llu"),
logfile, (unsigned long long)pos);
- VIR_FORCE_CLOSE(fd);
return -1;
}
- ret = virLXCProcessReadLogOutputData(vm,
- fd,
- buf,
- buflen);
-
- VIR_FORCE_CLOSE(fd);
- return ret;
+ return virLXCProcessReadLogOutputData(vm, fd, buf, buflen);
}