[vlc-commits] fb: fix invalid file close on error

Rémi Denis-Courmont git at videolan.org
Mon Dec 10 20:10:28 CET 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Dec 10 20:55:14 2018 +0200| [60dd4b25d3f951493252ee760edb3805fda1bb32] | committer: Rémi Denis-Courmont

fb: fix invalid file close on error

Do not vlc_close(0) or whatever sys->fd was.
I want to keep my standard input, thank you very much.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=60dd4b25d3f951493252ee760edb3805fda1bb32
---

 modules/video_output/fb.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/modules/video_output/fb.c b/modules/video_output/fb.c
index 38b7974cbf..524e3b63fd 100644
--- a/modules/video_output/fb.c
+++ b/modules/video_output/fb.c
@@ -186,6 +186,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
 
     /* Does the framebuffer uses hw acceleration? */
     sys->is_hw_accel = var_InheritBool(vd, "fb-hw-accel");
+    sys->fd = -1;
 
     /* Set tty and fb devices */
     sys->tty = 0; /* 0 == /dev/tty0 == current console */
@@ -504,7 +505,6 @@ static int OpenDisplay(vout_display_t *vd, bool force_resolution)
     /* Get framebuffer device information */
     if (ioctl(sys->fd, FBIOGET_VSCREENINFO, &sys->var_info)) {
         msg_Err(vd, "cannot get fb info (%s)", vlc_strerror_c(errno));
-        vlc_close(sys->fd);
         return VLC_EGENERIC;
     }
     sys->old_info = sys->var_info;
@@ -523,7 +523,6 @@ static int OpenDisplay(vout_display_t *vd, bool force_resolution)
 
     if (ioctl(sys->fd, FBIOPUT_VSCREENINFO, &sys->var_info)) {
         msg_Err(vd, "cannot set fb info (%s)", vlc_strerror_c(errno));
-        vlc_close(sys->fd);
         return VLC_EGENERIC;
     }
 
@@ -536,8 +535,6 @@ static int OpenDisplay(vout_display_t *vd, bool force_resolution)
 
         /* Restore fb config */
         ioctl(sys->fd, FBIOPUT_VSCREENINFO, &sys->old_info);
-
-        vlc_close(sys->fd);
         return VLC_EGENERIC;
     }
 
@@ -571,8 +568,6 @@ static int OpenDisplay(vout_display_t *vd, bool force_resolution)
         if (!sys->palette) {
             /* Restore fb config */
             ioctl(sys->fd, FBIOPUT_VSCREENINFO, &sys->old_info);
-
-            vlc_close(sys->fd);
             return VLC_ENOMEM;
         }
         sys->fb_cmap.start = 0;
@@ -607,8 +602,6 @@ static int OpenDisplay(vout_display_t *vd, bool force_resolution)
 
         /* Restore fb config */
         ioctl(sys->fd, FBIOPUT_VSCREENINFO, &sys->old_info);
-
-        vlc_close(sys->fd);
         return VLC_EGENERIC;
     }
 
@@ -628,8 +621,6 @@ static int OpenDisplay(vout_display_t *vd, bool force_resolution)
 
         /* Restore fb config */
         ioctl(sys->fd, FBIOPUT_VSCREENINFO, &sys->old_info);
-
-        vlc_close(sys->fd);
         return VLC_EGENERIC;
     }
 



More information about the vlc-commits mailing list