|
Check-in Number:
|
1952 | |
| Date: |
2002-Mar-06 11:33:15 (local)
2002-Mar-06 10:33:15 (UTC) |
| User: | rse |
| Branch: | |
| Comment: |
One more bugfix to the search & replace stuff. Manual page regex(3) says:
| Normally, regexec() returns 0 for success and the non-zero code
| REG_NOMATCH for failure. Other non-zero error codes may be returned
| in exceptional situations; see DIAGNOSTICS.
So we have to check for "!= 0" and not just "== REG_NOMATCH" or we would
perform substitutions with uninitialized data structures. |
| Tickets: |
|
| Inspections: |
|
| Files: |
|
ossp-pkg/var/var.c 1.81 -> 1.82
--- var.c 2002/03/06 10:18:19 1.81
+++ var.c 2002/03/06 10:33:15 1.82
@@ -930,8 +930,8 @@
regexec_flag = 0;
else
regexec_flag = REG_NOTBOL;
- if (regexec(&preg, p, sizeof(pmatch) / sizeof(regmatch_t), pmatch, regexec_flag) == REG_NOMATCH ||
- p + pmatch[0].rm_so == mydata.end) {
+ rc = regexec(&preg, p, sizeof(pmatch) / sizeof(regmatch_t), pmatch, regexec_flag);
+ if (rc != 0 || p + pmatch[0].rm_so == mydata.end) {
tokenbuf_append(&tmp, p, mydata.end - p);
break;
} else {
|
|