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;
}
*/
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
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 */