Commits

Armin Ronacher  committed 2ea91d6

Don't use strndup(): it is a GNU extension not available on other systems.
In particular, OS X does not have it.
Fixes bug #1.

  • Participants
  • Parent commits 2405433

Comments (0)

Files changed (1)

File src/common.c

         free(result->revision);
     if (len == -1)
         result->revision = strdup(revision);
-    else
-        result->revision = strndup(revision, len);
+    else {
+        result->revision = malloc(len + 1);
+        if (!result->revision)
+            return 0;
+        strncpy(result->revision, revision, len);
+        result->revision[len] = 0;
+    }
     return !!result->revision;
 }