summaryrefslogtreecommitdiffstats
path: root/grammar/rainerscript.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2012-04-23 16:54:08 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2012-04-23 16:54:08 +0200
commitfeac49c13b36ec885f73151dea6aee4e4b439cdc (patch)
tree14115d6710e475d44d584d7e733853140610c635 /grammar/rainerscript.c
parent9b06a4c26422b0a8727e1b3c6cc7141226186105 (diff)
downloadrsyslog-feac49c13b36ec885f73151dea6aee4e4b439cdc.tar.gz
rsyslog-feac49c13b36ec885f73151dea6aee4e4b439cdc.tar.xz
rsyslog-feac49c13b36ec885f73151dea6aee4e4b439cdc.zip
bugfix: number conversion in expression evaluation was not always correct
was invalid when the property was no string. Currently all props are strings, so this bug never could hit in practice.
Diffstat (limited to 'grammar/rainerscript.c')
-rw-r--r--grammar/rainerscript.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/grammar/rainerscript.c b/grammar/rainerscript.c
index d1d64e6e..320e66d0 100644
--- a/grammar/rainerscript.c
+++ b/grammar/rainerscript.c
@@ -743,9 +743,11 @@ var2Number(struct var *r, int *bSuccess)
if(r->datatype == 'S') {
n = es_str2num(r->d.estr, bSuccess);
} else {
- *bSuccess = 1;
+ n = r->d.n;
+ if(bSuccess)
+ *bSuccess = 1;
}
- return r->d.n;
+ return n;
}
/* ensure that retval is a string; if string is no number,