aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2004-02-15 19:37:24 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2004-02-15 19:37:24 +0000
commit6223f2de19299c8c076870ced9015f960b3e69c9 (patch)
treead636e3704f0a32f72b95772536ed90fc9dee982 /src
parente6f30fab4696a73db4150890ef7b7255c55ab11b (diff)
downloadellinika-6223f2de19299c8c076870ced9015f960b3e69c9.tar.gz
ellinika-6223f2de19299c8c076870ced9015f960b3e69c9.tar.bz2
If hostname begins with a slash, treat it as a path to UNIX socket
git-svn-id: file:///home/puszcza/svnroot/ellinika/trunk@11 941c8c0f-9102-463b-b60b-cd22ce0e6858
Diffstat (limited to 'src')
-rw-r--r--src/sql.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/sql.c b/src/sql.c
index 4b1a02b..e758b0c 100644
--- a/src/sql.c
+++ b/src/sql.c
@@ -10,10 +10,16 @@ MYSQL_RES *result;
void
sql_connect()
{
+ char *socket_path = NULL;
+
+ if (sql_host[0] == '/') {
+ socket_path = sql_host;
+ sql_host = "localhost";
+ }
if (!mysql_real_connect(&mysql,
sql_host, sql_user,
sql_password, sql_database, sql_port,
- NULL, 0)) {
+ socket_path, 0)) {
fprintf(stderr,
"cannot connect to MySQL server: %s\n",
mysql_error(&mysql));

Return to:

Send suggestions and report system problems to the System administrator.