diff options
author | marcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059> | 2010-01-13 13:26:54 +0800 |
---|---|---|
committer | marcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059> | 2010-01-13 13:26:54 +0800 |
commit | 5b5917dab23edb1a27546c878b903a4a5a35ca44 (patch) | |
tree | 875693ba02508c2531254a41dea0bab7ab69cd66 /security | |
parent | 3e45665b8cd8ba5114db651fe2d221039632bf09 (diff) | |
download | marcuscom-ports-5b5917dab23edb1a27546c878b903a4a5a35ca44.tar marcuscom-ports-5b5917dab23edb1a27546c878b903a4a5a35ca44.tar.gz marcuscom-ports-5b5917dab23edb1a27546c878b903a4a5a35ca44.tar.bz2 marcuscom-ports-5b5917dab23edb1a27546c878b903a4a5a35ca44.tar.lz marcuscom-ports-5b5917dab23edb1a27546c878b903a4a5a35ca44.tar.xz marcuscom-ports-5b5917dab23edb1a27546c878b903a4a5a35ca44.tar.zst marcuscom-ports-5b5917dab23edb1a27546c878b903a4a5a35ca44.zip |
Add a static implementation of strndup for FreeBSD < 7.2.
git-svn-id: svn://creme-brulee.marcuscom.com/ports/trunk@13446 df743ca5-7f9a-e211-a948-0013205c9059
Diffstat (limited to 'security')
-rw-r--r-- | security/gnome-keyring/files/patch-egg_egg-unix-credentials.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/security/gnome-keyring/files/patch-egg_egg-unix-credentials.c b/security/gnome-keyring/files/patch-egg_egg-unix-credentials.c new file mode 100644 index 000000000..5ae53f8b0 --- /dev/null +++ b/security/gnome-keyring/files/patch-egg_egg-unix-credentials.c @@ -0,0 +1,44 @@ +--- egg/egg-unix-credentials.c.orig 2010-01-13 00:21:23.000000000 -0500 ++++ egg/egg-unix-credentials.c 2010-01-13 00:25:46.000000000 -0500 +@@ -27,6 +27,7 @@ + + #include <sys/types.h> + #include <sys/socket.h> ++#include <sys/param.h> + #include <sys/uio.h> + #include <sys/un.h> + #include <errno.h> +@@ -37,6 +38,33 @@ + #include <ucred.h> + #endif + ++#if __FreeBSD_version < 701101 ++static char * ++strndup (const char *s, size_t n) ++{ ++ size_t nAvail; ++ char *p; ++ ++ if (s == NULL) ++ return NULL; ++ ++ if (memchr (s, '\0', n) != NULL) { ++ nAvail = strlen(s); ++ if (nAvail > n) ++ nAvail = n; ++ } else{ ++ nAvail = n; ++ } ++ p = malloc (nAvail + 1); ++ if (p == NULL) ++ return NULL; ++ memcpy (p, s, nAvail); ++ p[nAvail] = '\0'; ++ ++ return p; ++} ++#endif ++ + int + egg_unix_credentials_read (int sock, pid_t *pid, uid_t *uid) + { |