diff options
author | Alexey Yakovenko <wakeroid@gmail.com> | 2010-07-27 17:48:10 +0200 |
---|---|---|
committer | Alexey Yakovenko <wakeroid@gmail.com> | 2010-07-27 17:48:10 +0200 |
commit | 44f4ea70aea7d3e7d80fd5619d3b301d3abd3632 (patch) | |
tree | 610d6c3d8cbfb21072e1498271fb19acab18aca4 | |
parent | fe3f99c92a8437a353ba12075d6c3273d04c4e3f (diff) |
customizable socket dir through DDB_SOCKET_DIR env variable
-rw-r--r-- | main.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -270,7 +270,8 @@ server_start (void) { memcpy (srv_local.sun_path, server_id, sizeof (server_id)); int len = offsetof(struct sockaddr_un, sun_path) + sizeof (server_id)-1; #else - snprintf (srv_local.sun_path, sizeof (srv_local.sun_path), "%s/socket", dbconfdir); + char *socketdirenv = getenv ("DDB_SOCKET_DIR"); + snprintf (srv_local.sun_path, sizeof (srv_local.sun_path), "%s/socket", socketdirenv ? socketdirenv : dbconfdir); if (unlink(srv_local.sun_path) < 0) { perror ("INFO: unlink socket"); } @@ -569,7 +570,8 @@ main (int argc, char *argv[]) { memcpy (remote.sun_path, server_id, sizeof (server_id)); len = offsetof(struct sockaddr_un, sun_path) + sizeof (server_id)-1; #else - snprintf (remote.sun_path, sizeof (remote.sun_path), "%s/socket", dbconfdir); + char *socketdirenv = getenv ("DDB_SOCKET_DIR"); + snprintf (remote.sun_path, sizeof (remote.sun_path), "%s/socket", socketdirenv ? socketdirenv : dbconfdir); len = offsetof(struct sockaddr_un, sun_path) + strlen (remote.sun_path); #endif if (connect(s, (struct sockaddr *)&remote, len) == 0) { |