Skip to content
Snippets Groups Projects
Commit a0bf105b authored by Henrik (Grubba) Grubbström's avatar Henrik (Grubba) Grubbström
Browse files

Pike strings are NOT muteable!

Rev: src/modules/Msql/msqlmod.c:1.11
parent b7b7e56c
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* This code is (C) Francesco Chemolli, 1997. * This code is (C) Francesco Chemolli, 1997.
* You may use, modify and redistribute it freely under the terms * You may use, modify and redistribute it freely under the terms
* of the GNU General Public License, version 2. * of the GNU General Public License, version 2.
* $Id: msqlmod.c,v 1.10 1999/02/10 21:49:01 hubbe Exp $ * $Id: msqlmod.c,v 1.11 2000/04/13 18:37:16 grubba Exp $
* *
* This version is intended for Pike/0.5 and later. * This version is intended for Pike/0.5 and later.
* It won't compile under older versions of the Pike interpreter. * It won't compile under older versions of the Pike interpreter.
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#include "operators.h" #include "operators.h"
#include "multiset.h" #include "multiset.h"
RCSID("$Id: msqlmod.c,v 1.10 1999/02/10 21:49:01 hubbe Exp $"); RCSID("$Id: msqlmod.c,v 1.11 2000/04/13 18:37:16 grubba Exp $");
#include "version.h" #include "version.h"
#ifdef _REENTRANT #ifdef _REENTRANT
...@@ -216,18 +216,21 @@ static void msql_mod_create (INT32 args) ...@@ -216,18 +216,21 @@ static void msql_mod_create (INT32 args)
THIS->db_selected=0; THIS->db_selected=0;
} }
THREADS_ALLOW();
/* msql won' support specifying a port number to connect to. /* msql won' support specifying a port number to connect to.
* As far as I know, ':' is not a legal character in an hostname, * As far as I know, ':' is not a legal character in an hostname,
* so we'll silently ignore it. * so we'll silently ignore it.
*/ */
if (arg1) { if (arg1) {
colon=strchr(arg1->str,':'); colon=strchr(arg1->str,':');
if (colon) if (colon) {
*colon='\0'; arg1 = make_shared_binary_string(arg1->str,
colon - arg1->str);
free_string(sp[-args].u.string);
sp[-args].u.string = arg1;
}
} }
THREADS_ALLOW();
MSQL_LOCK(); MSQL_LOCK();
/* Warning! If there were no args, we're deferencing a NULL pointer!*/ /* Warning! If there were no args, we're deferencing a NULL pointer!*/
if (!arg1 || !strcmp (arg1->str,"localhost")) if (!arg1 || !strcmp (arg1->str,"localhost"))
...@@ -245,8 +248,7 @@ static void msql_mod_create (INT32 args) ...@@ -245,8 +248,7 @@ static void msql_mod_create (INT32 args)
} }
THIS->socket=sock; THIS->socket=sock;
THIS->connected=1; THIS->connected=1;
if (!arg2) if (arg2)
return;
do_select_db(arg2->str); do_select_db(arg2->str);
pop_n_elems(args); pop_n_elems(args);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment