# HG changeset patch # User filon # Date 1041765853 0 # Node ID 668b30187d480797dc0b816a5b4e590dab12e7f6 # Parent 98252605e29fd9ec2425b596bdc057395befc132 Check if we can open /dev/mem in preinit(), so we can exit cleanly. diff -r 98252605e29f -r 668b30187d48 libvo/vo_vesa.c --- a/libvo/vo_vesa.c Sun Jan 05 10:20:04 2003 +0000 +++ b/libvo/vo_vesa.c Sun Jan 05 11:24:13 2003 +0000 @@ -28,6 +28,7 @@ #include #include #include +#include #include "video_out.h" @@ -1009,6 +1010,7 @@ 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 @@ #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;