* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "gmqcc.h"
+#include <stdlib.h>
+#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include "gmqcc.h"
+
opts_cmd_t opts;
static const char *task_bins[] = {
data->pipes [0] = inhandle [1];
data->pipes [1] = outhandle[0];
data->pipes [2] = errhandle[0];
+
data->handles[0] = fdopen(inhandle [1], "w");
data->handles[1] = fdopen(outhandle[0], mode);
data->handles[2] = fdopen(errhandle[0], mode);
/* sigh */
- if (argv)
- vec_free(argv);
+ vec_free(argv);
return data->handles;
} else if (data->pid == 0) {
/* child */
close(errhandle[0]);
/* see piping documentation for this sillyness :P */
- close(0); (void)!dup(inhandle [0]);
- close(1); (void)!dup(outhandle[1]);
- close(2); (void)!dup(errhandle[1]);
+ dup2(inhandle [0], 0);
+ dup2(outhandle[1], 1);
+ dup2(errhandle[1], 2);
execvp(*argv, argv);
exit(EXIT_FAILURE);
task_popen_error_1: close(inhandle [0]), close(inhandle [1]);
task_popen_error_0:
- if (argv)
- vec_free(argv);
+ vec_free(argv);
return NULL;
}
case 'I': destval = &tmpl->sourcefile; break;
case 'F': destval = &tmpl->testflags; break;
default:
- con_printmsg(LVL_ERROR, __FILE__, __LINE__, "internal error",
+ con_printmsg(LVL_ERROR, __FILE__, __LINE__, 0, "internal error",
"invalid tag `%c:` during code generation\n",
tag
);
* assigned value.
*/
if (*destval) {
- con_printmsg(LVL_ERROR, file, line, "compile error",
+ con_printmsg(LVL_ERROR, file, line, 0, /*TODO: column for match*/ "compile error",
"tag `%c:` already assigned value: %s\n",
tag, *destval
);
*/
if (value && *value && (*value == ' ' || *value == '\t'))
value++;
+ else if (!value)
+ exit(EXIT_FAILURE);
/*
* Value will contain a newline character at the end, we need to strip
*/
if (strchr(value, '\n'))
*strrchr(value, '\n')='\0';
- else /* cppcheck: possible nullpointer dereference */
- exit(EXIT_FAILURE);
/*
* Now allocate and set the actual value for the specific tag. Which
*/
case '/':
if (data[1] != '/') {
- con_printmsg(LVL_ERROR, file, line, "tmpl parse error",
+ con_printmsg(LVL_ERROR, file, line, 0, /*TODO: column for match*/ "tmpl parse error",
"invalid character `/`, perhaps you meant `//` ?");
mem_d(back);
case 'I':
case 'F':
if (data[1] != ':') {
- con_printmsg(LVL_ERROR, file, line, "tmpl parse error",
+ con_printmsg(LVL_ERROR, file, line, 0, /*TODO: column for match*/ "tmpl parse error",
"expected `:` after `%c`",
*data
);
goto failure;
}
if (!task_template_generate(tmpl, *data, file, line, &data[3], pad)) {
- con_printmsg(LVL_ERROR, file, line, "tmpl compile error",
+ con_printmsg(LVL_ERROR, file, line, 0, /*TODO: column for match*/ "tmpl compile error",
"failed to generate for given task\n"
);
goto failure;
{
char *value = &data[3];
if (data[1] != ':') {
- con_printmsg(LVL_ERROR, file, line, "tmpl parse error",
+ con_printmsg(LVL_ERROR, file, line, 0, /*TODO: column for match*/ "tmpl parse error",
"expected `:` after `%c`",
*data
);
}
default:
- con_printmsg(LVL_ERROR, file, line, "tmpl parse error",
+ con_printmsg(LVL_ERROR, file, line, 0, /*TODO: column for match*/ "tmpl parse error",
"invalid tag `%c`", *data
);
goto failure;
return true;
failure:
- if (back)
- mem_d (back);
+ mem_d (back);
return false;
}
* Nullify all the template members otherwise NULL comparision
* checks will fail if tmpl pointer is reused.
*/
+ mem_d((*tmpl)->tempfilename);
mem_d(*tmpl);
}
else
util_debug("TEST", "removed stderr log file: %s\n", task_tasks[i].stderrlogfile);
- remove(task_tasks[i].tmpl->tempfilename);
+ (void)!remove(task_tasks[i].tmpl->tempfilename);
}
/* free util_strdup data for log files */
char *defs = NULL;
con_init();
+ OPTS_OPTION_U16(OPTION_MEMDUMPCOLS) = 16;
/*
* Command line option parsing commences now We only need to support
}
con_change(redirout, redirerr);
succeed = test_perform("tests", defs);
- util_meminfo();
+ stat_info();
return (succeed) ? EXIT_SUCCESS : EXIT_FAILURE;