summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorfilon <filon@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-01-05 11:24:13 +0000
committerfilon <filon@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-01-05 11:24:13 +0000
commite3bce499be5ee0436146ffc444361a820ce7f430 (patch)
tree7f9308daefa6e0f9ffb31a9cf7c7ecf740f83704 /libvo
parent3d394abb92c890b7e4c5f47cc1dcc82289addc67 (diff)
downloadmpv-e3bce499be5ee0436146ffc444361a820ce7f430.tar.bz2
mpv-e3bce499be5ee0436146ffc444361a820ce7f430.tar.xz
Check if we can open /dev/mem in preinit(), so we can exit cleanly.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8792 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r--libvo/vo_vesa.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libvo/vo_vesa.c b/libvo/vo_vesa.c
index bebfcfef90..3494d5eaef 100644
--- a/libvo/vo_vesa.c
+++ b/libvo/vo_vesa.c
@@ -28,6 +28,7 @@
#include <pwd.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <fcntl.h>
#include "video_out.h"
@@ -1009,6 +1010,7 @@ static void check_events(void)
static uint32_t preinit(const char *arg)
{
int pre_init_err = 0;
+ int fd;
if(verbose>1) printf("vo_vesa: preinit(%s) was called\n",arg);
if(verbose > 2)
printf("vo_vesa: subdevice %s is being initialized\n",arg);
@@ -1018,6 +1020,11 @@ static uint32_t preinit(const char *arg)
#ifdef CONFIG_VIDIX
else if(vidix_name) pre_init_err = vidix_preinit(vidix_name,&video_out_vesa);
#endif
+ // check if we can open /dev/mem (it will be opened later in config(), but if we
+ // detect now that we can't we can exit cleanly)
+ fd = open("/dev/mem", O_RDWR);
+ if (fd < 0)
+ return -1;
if(verbose > 2)
printf("vo_subdevice: initialization returns: %i\n",pre_init_err);
return pre_init_err;