Add a safe wrapper for write and fix some warnings
1. Add a function writeall and make swrite wrap that function. Use either writeall or swrite, depending on whether we want to exit on errors or not. 2. Fix warnings when compiling with a higher optimisation level. (CFLAGS ?= -pipe -O3 -march=native -mtune=native -freorder-blocks-and-partition) Signed-off-by: hwangcc <hwangcc@csie.nctu.edu.tw>
This commit is contained in:
@ -70,8 +70,14 @@ static int backtrace(void) {
|
||||
int stdin_pipe[2],
|
||||
stdout_pipe[2];
|
||||
|
||||
pipe(stdin_pipe);
|
||||
pipe(stdout_pipe);
|
||||
if (pipe(stdin_pipe) == -1) {
|
||||
ELOG("Failed to init stdin_pipe\n");
|
||||
return -1;
|
||||
}
|
||||
if (pipe(stdout_pipe) == -1) {
|
||||
ELOG("Failed to init stdout_pipe\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* close standard streams in case i3 is started from a terminal; gdb
|
||||
* needs to run without controlling terminal for it to work properly in
|
||||
|
Reference in New Issue
Block a user