diff options
author | Iku <iku@yokattana.com> | 2017-02-09 08:02:11 +0100 |
---|---|---|
committer | Iku <iku@yokattana.com> | 2017-02-09 09:09:31 +0100 |
commit | 895334d111060e805fbbe60b9020f6c32f3b90c5 (patch) | |
tree | d361f38c0da23960884e42191767364bce2d541d /src/exec.c | |
parent | 474e05785ad4ecb3b40626093c51e9f69acf9000 (diff) |
Address compiler warnings
(Compiling with GCC 4.8.4 on LXSS/Ubuntu)
- unused results
- incorrect size argument in fgetws
One unused result warning, for dup(), has not been addressed because the
author is not familiar with its use.
Diffstat (limited to 'src/exec.c')
-rw-r--r-- | src/exec.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -61,12 +61,20 @@ int exec_cmd (char * line) { close(my_pipe[1]); // parent doesn't write char reading_buf[2]; - while (read(my_pipe[0], reading_buf, 1) > 0) - write(1, reading_buf, 1); + while (read(my_pipe[0], reading_buf, 1) > 0) { + if (!write(1, reading_buf, 1)) { + perror(NULL); + exit(-1); + } + } close(my_pipe[0]); wait(&waitres); - system("echo -n 'Press ENTER to return.'"); + if (system("echo -n 'Press ENTER to return.'") == -1) { + /* system() call itself failed */ + perror(NULL); + exit(-1); + } getchar(); reset_prog_mode(); |