aboutsummaryrefslogtreecommitdiff
path: root/net/udpcast/files/patch-rateGovernor.c
blob: 14de493ebb0215b90ec1bd170d4f3c344e197d13 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
--- rateGovernor.c.orig	2008-09-20 09:07:29.000000000 +0200
+++ rateGovernor.c	2009-02-09 08:20:17.000000000 +0100
@@ -23,6 +23,25 @@
 #define DL_RATE_GOVERNOR
 #endif
 
+
+#ifdef __FreeBSD__
+char *
+strndup(const char *str, size_t n)
+{
+  size_t len;
+  char *copy;
+
+  for (len = 0; len < n && str[len]; len++)
+    continue;
+
+  if ((copy = malloc(len + 1)) == NULL)
+    return (NULL);
+  memcpy(copy, str, len);
+  copy[len] = '\0';
+  return (copy);
+}
+#endif
+
 void *rgInitGovernor(struct net_config *cfg, struct rateGovernor_t *gov)
 {
   if(cfg->nrGovernors == MAX_GOVERNORS) {