ossp-pkg/var/var.c 1.50 -> 1.51
--- var.c 2001/12/14 13:47:01 1.50
+++ var.c 2001/12/14 14:06:50 1.51
@@ -1920,18 +1920,29 @@
tokenbuf_init(&output);
rc = input(input_buf, input_buf + input_len, config, nameclass,
lookup, lookup_context, force_expand, &output, 0, 0, NULL);
- *result = (char *)output.begin;
- *result_len = output.end - output.begin;
+
+ /* Post-process output */
if (rc >= 0) {
+ /* always NUL-terminate output for convinience reasons */
if (!tokenbuf_append(&output, "\0", 1)) {
tokenbuf_free(&output);
return VAR_ERR_OUT_OF_MEMORY;
}
output.end--;
+
+ /* Provide results */
+ *result = (char *)output.begin;
+ *result_len = output.end - output.begin;
+
+ /* canonify all positive answers */
rc = VAR_OK;
}
- *result = (char *)output.begin;
- *result_len = output.end - output.begin;
+ else {
+ /* Provide error results */
+ *result = (char *)input_buf;
+ *result_len = output.end - output.begin; /* FIXME */
+ }
+
return rc;
}
|
|