From 94cddaf48c23141260bfbeb7be034b379e9b8726 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 2 Jan 2011 16:07:00 +0100 Subject: [PATCH] libtriple: fix filedescriptor leak in cVideo::routeVideo() Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/e786a4ef75f9ae7ee8919f4d51ba6aabdfc72a97 Author: Stefan Seyfried Date: 2011-01-02 (Sun, 02 Jan 2011) --- lib/libtriple/video_td.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/libtriple/video_td.cpp b/lib/libtriple/video_td.cpp index 523ba563e..cd0eb401e 100644 --- a/lib/libtriple/video_td.cpp +++ b/lib/libtriple/video_td.cpp @@ -654,16 +654,16 @@ void cVideo::routeVideo(int standby) perror("IOC_AVS_SCART_PIN8_FOLLOW_VCR"); if (ioctl(avsfd, IOC_AVS_ROUTE_VCR2TV) < 0) perror("IOC_AVS_ROUTE_VCR2TV"); - return; + } else { + unsigned char fblk = 1; + printf("[%s] setting fastblank to %d, pin8 to %dV, routing encoder to TV\n", __FUNCTION__, fblk, scartvoltage); + if (ioctl(avsfd, IOC_AVS_FASTBLANK_SET, fblk) < 0) + perror("IOC_AVS_FASTBLANK_SET, fblk"); + if (ioctl(avsfd, IOC_AVS_SCART_PIN8_SET, scartvoltage) < 0) + perror("IOC_AVS_SCART_PIN8_SET"); + if (ioctl(avsfd, IOC_AVS_ROUTE_ENC2TV) < 0) + perror("IOC_AVS_ROUTE_ENC2TV"); } - unsigned char fblk = 1; - printf("[%s] setting fastblank to %d, pin8 to %dV, routing encoder to TV\n", __FUNCTION__, fblk, scartvoltage); - if (ioctl(avsfd, IOC_AVS_FASTBLANK_SET, fblk) < 0) - perror("IOC_AVS_FASTBLANK_SET, fblk"); - if (ioctl(avsfd, IOC_AVS_SCART_PIN8_SET, scartvoltage) < 0) - perror("IOC_AVS_SCART_PIN8_SET"); - if (ioctl(avsfd, IOC_AVS_ROUTE_ENC2TV) < 0) - perror("IOC_AVS_ROUTE_ENC2TV"); close(avsfd); }