summaryrefslogtreecommitdiff
path: root/devel/SDL/patches
diff options
context:
space:
mode:
authorben <ben>2006-10-08 18:40:23 +0000
committerben <ben>2006-10-08 18:40:23 +0000
commit730e5e1824aef4e3fa14b25bb01f6330b3d8ba56 (patch)
tree5488fe21e55f5e249642964558c261f404adff6e /devel/SDL/patches
parent5809a0ff21ad14fa455b0d3f4a4ad0edb2cd98db (diff)
downloadpkgsrc-730e5e1824aef4e3fa14b25bb01f6330b3d8ba56.tar.gz
Fix patch-aa to correctly use strcat, and to be C89 compliant.
Patch supplied by Christian Biere in PR#34738.
Diffstat (limited to 'devel/SDL/patches')
-rw-r--r--devel/SDL/patches/patch-aa41
1 files changed, 21 insertions, 20 deletions
diff --git a/devel/SDL/patches/patch-aa b/devel/SDL/patches/patch-aa
index 36dec355f2e..6338460d37f 100644
--- a/devel/SDL/patches/patch-aa
+++ b/devel/SDL/patches/patch-aa
@@ -1,37 +1,38 @@
-$NetBSD: patch-aa,v 1.13 2006/07/01 19:08:36 jmmv Exp $
+$NetBSD: patch-aa,v 1.14 2006/10/08 18:40:23 ben Exp $
---- src/loadso/dlopen/SDL_sysloadso.c.orig 2006-05-01 10:02:37.000000000 +0200
+--- src/loadso/dlopen/SDL_sysloadso.c.orig 2006-05-01 01:02:37.000000000 -0700
+++ src/loadso/dlopen/SDL_sysloadso.c
-@@ -31,9 +31,31 @@
+@@ -31,9 +31,32 @@
#include "SDL_loadso.h"
-+const char *libdirs[] = {
-+ PREFIX "/lib/",
-+ X11BASE "/lib/",
-+ NULL
-+};
-+
- void *SDL_LoadObject(const char *sofile)
- {
-- void *handle = dlopen(sofile, RTLD_NOW);
-+ int i;
++static void *get_dlopen_handle(const char *sofile)
++{
++ static const char * const libdirs[] = {
++ PREFIX "/lib/",
++ X11BASE "/lib/",
++ };
++ unsigned i;
+ void *handle;
+
-+ i = 0;
-+ handle = NULL;
-+ while (libdirs[i] != NULL && handle == NULL) {
++ for (i = 0; i < sizeof libdirs / sizeof libdirs[0]; i++) {
+ char buf[1024];
+
+ strncpy(buf, libdirs[i], sizeof(buf) - 1);
+ buf[sizeof(buf) - 1] = '\0';
-+ strncat(buf, sofile, sizeof(buf) - 1);
-+ buf[sizeof(buf) - 1] = '\0';
++ strncat(buf, sofile, sizeof(buf) - strlen(buf) - 1);
+
+ handle = dlopen(buf, RTLD_NOW);
-+
-+ i++;
++ if (handle)
++ break;
+ }
++ return handle;
++}
++
+ void *SDL_LoadObject(const char *sofile)
+ {
+- void *handle = dlopen(sofile, RTLD_NOW);
++ void *handle = get_dlopen_handle(sofile);
const char *loaderror = (char *)dlerror();
if ( handle == NULL ) {
SDL_SetError("Failed loading %s: %s", sofile, loaderror);