From: Sebastian Harl Date: Wed, 14 Jan 2015 20:56:22 +0000 (+0100) Subject: connection: Update the connection name as early as possible. X-Git-Tag: sysdb-0.7.0~74 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=31a4f8af85cc4e9279677c40cbb11496409ff8f6;p=sysdb.git connection: Update the connection name as early as possible. This is just to avoid weird error messages if setting up the connection failed. --- diff --git a/src/frontend/connection.c b/src/frontend/connection.c index f35f7b3..c35d2d2 100644 --- a/src/frontend/connection.c +++ b/src/frontend/connection.c @@ -156,6 +156,10 @@ connection_init(sdb_object_t *obj, va_list ap) return -1; } + /* update the object name */ + snprintf(obj->name + strlen(CONN_FD_PREFIX), + strlen(CONN_FD_PLACEHOLDER), "%i", conn->fd); + /* defaults */ conn->read = conn_read; conn->write = conn_write; @@ -193,10 +197,6 @@ connection_init(sdb_object_t *obj, va_list ap) conn->cmd = SDB_CONNECTION_IDLE; conn->cmd_len = 0; conn->skip_len = 0; - - /* update the object name */ - snprintf(obj->name + strlen(CONN_FD_PREFIX), - strlen(CONN_FD_PLACEHOLDER), "%i", conn->fd); return 0; } /* connection_init */