summaryrefslogtreecommitdiff
path: root/src/simple.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/simple.c')
-rw-r--r--src/simple.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/simple.c b/src/simple.c
index da79562..be92977 100644
--- a/src/simple.c
+++ b/src/simple.c
@@ -12,7 +12,7 @@
12static void 12static void
13usage(void) 13usage(void)
14{ 14{
15 (void) fprintf(stderr, "compress [-d] infile outfile\n"); 15 (void) fprintf(stderr, "simple [-d] infile outfile\n");
16} 16}
17 17
18static void 18static void
@@ -142,10 +142,19 @@ main(int argc, char *argv[])
142 142
143 if ( argc != 2 ) { 143 if ( argc != 2 ) {
144 usage(); 144 usage();
145 return EXIT_FAILURE;
146 }
147
148 FILE *in_file = fopen(argv[0], "rb");
149 if ( in_file == NULL ) {
150 error("fopen() on in_file failed");
145 } 151 }
146 152
147 FILE *in_file = fopen(argv[0], "rb");
148 FILE *out_file = fopen(argv[1], "wb"); 153 FILE *out_file = fopen(argv[1], "wb");
154 if ( out_file == NULL ) {
155 (void) fclose(in_file);
156 error("fopen() on out_file failed");
157 }
149 158
150 if ( !decompress ) { 159 if ( !decompress ) {
151 do_compress(in_file, out_file, compress_level); 160 do_compress(in_file, out_file, compress_level);