changeset 17:830af7de3403

sipout-test-voice: disallow empty files for play command
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 13 May 2024 22:31:24 -0800
parents 4f81b959a5f5
children f7321b25195e
files test-voice/rtp_tx.c
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/test-voice/rtp_tx.c	Mon May 13 22:10:25 2024 -0800
+++ b/test-voice/rtp_tx.c	Mon May 13 22:31:24 2024 -0800
@@ -216,6 +216,11 @@
 		fprintf(stderr, "error: %s is not a regular file\n", filename);
 		return;
 	}
+	if (!st.st_size) {
+		close(fd);
+		fprintf(stderr, "error: %s is an empty file\n", filename);
+		return;
+	}
 	if (st.st_size % 160) {
 		close(fd);
 		fprintf(stderr,
@@ -260,6 +265,11 @@
 		fprintf(stderr, "error: %s is not a regular file\n", filename);
 		return;
 	}
+	if (!st.st_size) {
+		close(fd);
+		fprintf(stderr, "error: %s is an empty file\n", filename);
+		return;
+	}
 	if (st.st_size % 160) {
 		close(fd);
 		fprintf(stderr,