diff options
author | Joey Hess <joey@kitenet.net> | 2012-05-22 13:39:24 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-05-22 13:39:24 -0400 |
commit | d6ef4a470f5ba8b7b36d39cd1cb2418d58257fc0 (patch) | |
tree | 0da2ef349c8923d080f8161286b769c6ccbe3c38 | |
parent | d4f8bd597243c251d8528b5f6e5e1993dda42ccb (diff) | |
download | moreutils-d6ef4a470f5ba8b7b36d39cd1cb2418d58257fc0.tar.gz |
fix cleanup on error
-rw-r--r-- | pee.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -40,7 +40,7 @@ main(int argc, char **argv) { pipes[i - 1] = popen(argv[i], "w"); if (!pipes[i - 1]) { fprintf(stderr, "Can not open pipe to '%s\'\n", argv[i]); - close_pipes(pipes, i); + close_pipes(pipes, argc); exit(EXIT_FAILURE); } @@ -52,7 +52,7 @@ main(int argc, char **argv) { for(i = 0; i < argc; i++) { if (fwrite(buf, sizeof(char), r, pipes[i]) != r) { fprintf(stderr, "Write error to `%s\'\n", argv[i + 1]); - close_pipes(pipes, i); + close_pipes(pipes, argc); exit(EXIT_FAILURE); } } |