From f3252b34114236c65624862d2a572f5e290e8cc8 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Fri, 1 Mar 2013 14:34:21 +0100 Subject: Revamping for listeners. Split rs_connection into rs_baseconn plus rs_connection and rs_listener. Connections now has a state variable. Connect buffer event and fd of _source_ connection, not that of conn->active_peer. The connection object referred to by a peer is not meant for using as a connection, only for reporting errors on. Make sure things are sane even when not using a config file. Bump library interface version to 1.0.0 since it's changed. --- lib/util.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/util.c') diff --git a/lib/util.c b/lib/util.c index eceaec9..671fcde 100644 --- a/lib/util.c +++ b/lib/util.c @@ -11,9 +11,10 @@ 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); + if (buf) + strcpy (buf, s); + else + rs_err_ctx_push (ctx, RSE_NOMEM, NULL); - rs_err_ctx_push (ctx, RSE_NOMEM, NULL); - return NULL; + return buf; } -- cgit v1.1