Skip to content

Instantly share code, notes, and snippets.

@guyzmo
Created November 29, 2012 17:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guyzmo/4170462 to your computer and use it in GitHub Desktop.
Save guyzmo/4170462 to your computer and use it in GitHub Desktop.
Patch for strnlen support in freevpn (for OSX 10.6)
diff --git a/platform/io.c b/platform/io.c
index 209666a..0a6c2cf 100644
--- a/platform/io.c
+++ b/platform/io.c
@@ -24,6 +24,16 @@
#if defined(__FreeBSD__)
#define IO_BSD
#elif defined(__APPLE__)
+size_t strnlen(const char *s, size_t maxlen)
+{
+ size_t len;
+
+ for (len = 0; len < maxlen; len++, s++) {
+ if (!*s)
+ break;
+ }
+ return (len);
+}
#define IO_BSD
#define IO_USE_SELECT
#elif defined(WIN32)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment