[MPlayer-cvslog] r37694 - trunk/libvo/vo_aa.c

reimar subversion at mplayerhq.hu
Fri Feb 12 21:23:40 CET 2016


Author: reimar
Date: Fri Feb 12 21:23:39 2016
New Revision: 37694

Log:
vo_aa: check fstat return value.

Modified:
   trunk/libvo/vo_aa.c

Modified: trunk/libvo/vo_aa.c
==============================================================================
--- trunk/libvo/vo_aa.c	Fri Feb 12 21:20:10 2016	(r37693)
+++ trunk/libvo/vo_aa.c	Fri Feb 12 21:23:39 2016	(r37694)
@@ -681,17 +681,18 @@ static int preinit(const char *arg)
     if ( hidis==NULL ){
 	struct stat sbuf;
 	char fname[12];
-	FILE *fp;
+	FILE *fp = NULL;
 	int fd, vt;
 	/* check /dev/vcsa<vt> */
 	/* check only, if no driver is explicit set */
 	fd = dup (fileno (stderr));
-	fstat (fd, &sbuf);
+	if (fstat (fd, &sbuf) != -1) {
 	// vt number stored in device minor
 	vt = sbuf.st_rdev & 0xff;
-	close (fd);
 	sprintf (fname, "/dev/vcsa%2.2i", vt);
 	fp = fopen (fname, "w+");
+	}
+	close (fd);
 	if (fp==NULL){
 	    fprintf(stderr,"VO: [aa] cannot open %s for writing,"
 			"so we'll not use linux driver\n", fname);


More information about the MPlayer-cvslog mailing list