summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--main.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/main.c b/main.c
index abef591..a52551e 100644
--- a/main.c
+++ b/main.c
@@ -126,8 +126,13 @@ main(int ac, char *av[])
 				}
 			break;
 		case 'o':
-			if (strcmp(optarg, "-") != 0)
+			if (strcmp(optarg, "-") != 0) {
 				outf = fopen(optarg, "w");
+				if (!outf) {
+					fprintf(stderr, "cannot open '%s'\n", optarg);
+					exit(1);
+				}
+			}
 			break;
 		case 't':
 			for (tm=tmap;; tm++) {