diff --git a/src/attachment.c b/src/attachment.c index 1e3fbccb..483c16d5 100644 --- a/src/attachment.c +++ b/src/attachment.c @@ -18,7 +18,7 @@ int store_attachments(struct session_data *sdata, struct _state *state, struct __config *cfg){ uint64 id=0; - int i, found; + int i, found, affected_rows; char s[SMALLBUFSIZE]; MYSQL_RES *res; MYSQL_ROW row; @@ -117,6 +117,12 @@ int store_attachments(struct session_data *sdata, struct _state *state, struct _ return 1; } + affected_rows = mysql_stmt_affected_rows(stmt); + if(affected_rows != 1){ + syslog(LOG_PRIORITY, "%s attachment sql error: affected rows: %d", sdata->ttmpfile, affected_rows); + return 1; + } + } else { syslog(LOG_PRIORITY, "%s: skipping attachment (serial: %d, size: %d, digest: %s)", sdata->ttmpfile, i, state->attachments[i].size, state->attachments[i].digest);