changeset 132:aa278d75d757

themwi-update-outrt: catch and reject empty tables
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 06 Oct 2022 22:49:26 -0800
parents 5c7109183c8c
children 765991f42d86
files utils/themwi-update-outrt.c
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/utils/themwi-update-outrt.c	Thu Oct 06 21:19:59 2022 -0800
+++ b/utils/themwi-update-outrt.c	Thu Oct 06 22:49:26 2022 -0800
@@ -463,6 +463,14 @@
 	for (lineno = 1; fgets(linebuf, sizeof linebuf, inf); lineno++)
 		process_line();
 	fclose(inf);
+	if (!dest_rec_count) {
+		fprintf(stderr, "error: no SIP destinations defined\n");
+		exit(1);
+	}
+	if (!inn_rec_count && !special_num_count) {
+		fprintf(stderr, "error: no routes defined\n");
+		exit(1);
+	}
 	emit_output();
 	/* make it live */
 	if (rename("out-routes.newbin", "out-routes.bin") < 0) {