summaryrefslogtreecommitdiff
path: root/lib/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/util.c')
-rw-r--r--lib/util.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/util.c b/lib/util.c
new file mode 100644
index 0000000..3c9fef6
--- /dev/null
+++ b/lib/util.c
@@ -0,0 +1,19 @@
+/* Copyright 2012 NORDUnet A/S. All rights reserved.
+ See the file COPYING for licensing information. */
+
+#include <string.h>
+#include <radsec/radsec.h>
+#include <radsec/radsec-impl.h>
+#include "util.h"
+
+char *
+rs_strdup (struct rs_context *ctx, const char *s)
+{
+ char *buf = rs_calloc (ctx, 1, strlen (s) + 1);
+
+ if (buf != NULL)
+ return strcpy (buf, s);
+
+ rs_err_ctx_push (ctx, RSE_NOMEM, NULL);
+ return NULL;
+}