X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=mysql_selector.c;h=0635f855f73833f64eabb10e5cd0660960586965;hp=dedc96cc8ec6961bf118c78586bb3c5be037fb04;hb=aea0aba712b2170e2d39ffa1c8f8cb55fc0881bf;hpb=843950e7a85730b796bb6238b6e91111f7209c25 diff --git a/mysql_selector.c b/mysql_selector.c index dedc96cc..0635f855 100644 --- a/mysql_selector.c +++ b/mysql_selector.c @@ -10,16 +10,20 @@ #define MEDIUM_BLOB_SIZE 16777220 /* (2**24 + 4) */ #define BLOB_SIZE 65539 /* (2**16 + 3) */ /** \endcond */ + +#include "para.h" #include "server.cmdline.h" +#include "afh.h" #include "server.h" #include "vss.h" -#include "afs.h" +#include "afs_common.h" #include #include #include #include "error.h" #include "net.h" #include "string.h" +#include "list.h" #include "user_list.h" #include "mysql_selector_command_list.h" #include "ipc.h" @@ -67,11 +71,11 @@ static const struct para_macro mysql_macro_list[] = { }; /** - * simple search and replace routine + * Simple search and replace routine. * - * \param src source string - * \param macro_name the name of the macro - * \param replacement the replacement format string + * \param src Source String. + * \param macro_name The name of the macro. + * \param replacement The replacement format string. * * In \p src, replace each occurence of \p macro_name(arg) by the string * determined by the \p replacement format string. \p replacement may (but @@ -79,7 +83,7 @@ static const struct para_macro mysql_macro_list[] = { * replaced by \p arg. * * \return A string in which all matches in \p src are replaced, or \p NULL if - * an syntax error was encountered. Caller must free the result. + * an error was encountered. Caller must free the result. * * \sa regcomp(3) */ @@ -95,7 +99,8 @@ __must_check __malloc static char *s_a_r(const char *src, const char* macro_name if (!macro_name || !replacement || !src) return para_strdup(src); - regcomp(&preg, macro_name, 0); + if (regcomp(&preg, macro_name, 0) != 0) + return NULL; while (regexec(&preg, bufptr, nmatch, pmatch, eflags) != REG_NOMATCH) { char *tmp, *arg, *o_bracket, *c_bracket; @@ -2270,6 +2275,7 @@ static void shutdown_connection(void) ret = mutex_destroy(mysql_lock); if (ret < 0) PARA_ERROR_LOG("%s\n", PARA_STRERROR(-ret)); + mysql_lock = 0; } }