diff mbox

[4/5] pgsql: only disable key if it starts with underscore

Message ID 1343856436-11129-5-git-send-email-eric@regit.org
State Accepted
Headers show

Commit Message

Eric Leblond Aug. 1, 2012, 9:27 p.m. UTC
ulogd2 was magically making inactive the first key of description
table. This patch improves this system by only doing so when
the key start with an undescore. This way, system like nfacct which
do not have a primary key can be implemented easily.
---
 output/pgsql/ulogd_output_PGSQL.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Pablo Neira Ayuso Aug. 3, 2012, 9:29 a.m. UTC | #1
On Wed, Aug 01, 2012 at 11:27:15PM +0200, Eric Leblond wrote:
> ulogd2 was magically making inactive the first key of description
> table. This patch improves this system by only doing so when
> the key start with an undescore. This way, system like nfacct which
> do not have a primary key can be implemented easily.

Applied with minor glitch, thanks.

> ---
>  output/pgsql/ulogd_output_PGSQL.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/output/pgsql/ulogd_output_PGSQL.c b/output/pgsql/ulogd_output_PGSQL.c
> index 9529b1c..44600b0 100644
> --- a/output/pgsql/ulogd_output_PGSQL.c
> +++ b/output/pgsql/ulogd_output_PGSQL.c
> @@ -195,8 +195,10 @@ static int get_columns_pgsql(struct ulogd_pluginstance *upi)
>  		strncpy(upi->input.keys[i].name, buf, ULOGD_MAX_KEYLEN);
>  	}
>  
> -	/* ID is a sequence */
> -	upi->input.keys[0].flags |= ULOGD_KEYF_INACTIVE;
> +	/* ID (starting by '.') is a sequence */
> +	if (upi->input.keys[0].name[0] == '.') {
> +	    upi->input.keys[0].flags |= ULOGD_KEYF_INACTIVE;
> +	}

No need for brackets here. Also fixed indentation.

>  
>  	PQclear(pi->pgres);
>  	return 0;
> -- 
> 1.7.10.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/output/pgsql/ulogd_output_PGSQL.c b/output/pgsql/ulogd_output_PGSQL.c
index 9529b1c..44600b0 100644
--- a/output/pgsql/ulogd_output_PGSQL.c
+++ b/output/pgsql/ulogd_output_PGSQL.c
@@ -195,8 +195,10 @@  static int get_columns_pgsql(struct ulogd_pluginstance *upi)
 		strncpy(upi->input.keys[i].name, buf, ULOGD_MAX_KEYLEN);
 	}
 
-	/* ID is a sequence */
-	upi->input.keys[0].flags |= ULOGD_KEYF_INACTIVE;
+	/* ID (starting by '.') is a sequence */
+	if (upi->input.keys[0].name[0] == '.') {
+	    upi->input.keys[0].flags |= ULOGD_KEYF_INACTIVE;
+	}
 
 	PQclear(pi->pgres);
 	return 0;