Browse Source

Fix warning

Serj Kalichev 7 years ago
parent
commit
977a3cd850
1 changed files with 3 additions and 2 deletions
  1. 3 2
      clish/shell/shell_execute.c

+ 3 - 2
clish/shell/shell_execute.c

@@ -211,6 +211,7 @@ static int clish_shell_exec_oaction(clish_hook_oaction_fn_t func,
 		struct iovec *iov;
 		struct iovec *iov;
 		const int rsize = CLISH_STDOUT_CHUNK; /* Read chunk size */
 		const int rsize = CLISH_STDOUT_CHUNK; /* Read chunk size */
 		size_t cur_size = 0;
 		size_t cur_size = 0;
+		ssize_t r = 0;
 
 
 		close(pipe1[1]);
 		close(pipe1[1]);
 		close(pipe2[0]);
 		close(pipe2[0]);
@@ -244,14 +245,14 @@ static int clish_shell_exec_oaction(clish_hook_oaction_fn_t func,
 			iov = lub_list_node__get_data(node);
 			iov = lub_list_node__get_data(node);
 			lub_list_del(l, node);
 			lub_list_del(l, node);
 			lub_list_node_free(node);
 			lub_list_node_free(node);
-			write(pipe2[1], iov->iov_base, iov->iov_len);
+			r = write(pipe2[1], iov->iov_base, iov->iov_len);
 			free(iov->iov_base);
 			free(iov->iov_base);
 			free(iov);
 			free(iov);
 		}
 		}
 		close(pipe2[1]);
 		close(pipe2[1]);
 
 
 		lub_list_free(l);
 		lub_list_free(l);
-		_exit(0);
+		_exit(r < 0 ? 1 : 0);
 	}
 	}
 
 
 	real_stdout = dup(STDOUT_FILENO);
 	real_stdout = dup(STDOUT_FILENO);