Check for error in pipe call

This commit is contained in:
Francesco Abbate 2021-03-17 18:29:50 +01:00
parent 30f9f20e23
commit ac0728d073
1 changed files with 2 additions and 4 deletions

View File

@ -26,7 +26,7 @@ static int join_path(char buf[], int buf_size, const char *path, const char *nam
static int xrdb_popen (int *pid_ptr) { static int xrdb_popen (int *pid_ptr) {
int fd[2]; int fd[2];
pipe(fd); if (pipe(fd) != 0) return -1;
int read_fd = fd[0]; int read_fd = fd[0];
int write_fd = fd[1]; int write_fd = fd[1];
@ -104,10 +104,8 @@ static int xrdb_parse_for_dpi(int read_fd) {
/* Line is too long for the buffer: skip. */ /* Line is too long for the buffer: skip. */
read_buf_offset = 0; read_buf_offset = 0;
} else { } else {
int c = 0; for (int c = 0; c < rem; c++) {
while (c < rem) {
buf[c] = line_start[c]; buf[c] = line_start[c];
c++;
} }
read_buf_offset = rem; read_buf_offset = rem;
} }