Skip to content

Commit

Permalink
errno fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jsuto committed Jul 10, 2014
1 parent 5abff0f commit 0ff5ab9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ struct session_data {
int journal_envelope_length, journal_bottom_length;
#ifdef NEED_MYSQL
MYSQL mysql;
unsigned int errno;
unsigned int mysql_errno;
#endif
#ifdef NEED_PSQL
PGconn *psql;
Expand Down
2 changes: 1 addition & 1 deletion src/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ void init_session_data(struct session_data *sdata, struct __config *cfg){
sdata->sent = sdata->delivered = sdata->retained = sdata->now;

#ifdef NEED_MYSQL
sdata->errno = 0;
sdata->mysql_errno = 0;
#endif

#ifdef HAVE_TWEAK_SENT_TIME
Expand Down
10 changes: 5 additions & 5 deletions src/mysql.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ int p_exec_query(struct session_data *sdata, MYSQL_STMT *stmt, struct __data *da
unsigned long length[MAX_SQL_VARS];
int i, ret=ERR;

sdata->errno = 0;
sdata->mysql_errno = 0;
memset(bind, 0, sizeof(bind));

for(i=0; i<MAX_SQL_VARS; i++){
Expand Down Expand Up @@ -106,14 +106,14 @@ int p_exec_query(struct session_data *sdata, MYSQL_STMT *stmt, struct __data *da
}

if(mysql_stmt_bind_param(stmt, bind)){
sdata->errno = mysql_stmt_errno(stmt);
syslog(LOG_PRIORITY, "%s: mysql_stmt_bind_param() error: %s (errno: %d)", sdata->ttmpfile, mysql_stmt_error(stmt), sdata->errno);
sdata->mysql_errno = mysql_stmt_errno(stmt);
syslog(LOG_PRIORITY, "%s: mysql_stmt_bind_param() error: %s (errno: %d)", sdata->ttmpfile, mysql_stmt_error(stmt), sdata->mysql_errno);
goto CLOSE;
}

if(mysql_stmt_execute(stmt)){
sdata->errno = mysql_stmt_errno(stmt);
syslog(LOG_PRIORITY, "%s: mysql_stmt_execute error: *%s* (errno: %d)", sdata->ttmpfile, mysql_error(&(sdata->mysql)), sdata->errno);
sdata->mysql_errno = mysql_stmt_errno(stmt);
syslog(LOG_PRIORITY, "%s: mysql_stmt_execute error: *%s* (errno: %d)", sdata->ttmpfile, mysql_error(&(sdata->mysql)), sdata->mysql_errno);
goto CLOSE;
}

Expand Down

0 comments on commit 0ff5ab9

Please sign in to comment.