openbsd-ports/devel/libdvdread/patches/patch-dvdread_dvd_input_c
2003-02-24 22:54:03 +00:00

48 lines
1.1 KiB
Plaintext

$OpenBSD: patch-dvdread_dvd_input_c,v 1.2 2003/02/24 22:54:03 espie Exp $
--- dvdread/dvd_input.c.orig Thu Feb 13 22:48:24 2003
+++ dvdread/dvd_input.c Mon Feb 24 23:37:30 2003
@@ -257,6 +257,32 @@ static int file_close(dvd_input_t dev)
return 0;
}
+#ifdef __OpenBSD__
+#include <dirent.h>
+#include <string.h>
+static void *findlibrary(char *base)
+{
+ DIR *d;
+ struct dirent *de;
+ size_t len;
+ void *lib = NULL;
+
+ len = strlen(base);
+
+ d = opendir(".");
+ if (!d)
+ return lib;
+ while ((de = readdir(d)) != NULL) {
+ if (strncmp(de->d_name, base, len) != 0)
+ continue;
+ lib = dlopen(de->d_name, RTLD_LAZY);
+ if (lib)
+ break;
+ }
+ closedir(d);
+ return lib;
+}
+#endif
/**
* Setup read functions with either libdvdcss or minimal DVD access.
@@ -275,6 +301,10 @@ int dvdinput_setup(void)
#else
/* dlopening libdvdcss */
dvdcss_library = dlopen("libdvdcss.so.2", RTLD_LAZY);
+#if defined(__OpenBSD__)
+ if (!dvdcss_library)
+ dvdcss_library = findlibrary("libdvdcss.so.2.");
+#endif
if(dvdcss_library != NULL) {
#if defined(__OpenBSD__) && !defined(__ELF__)