comparison test-voice/rtp_tx.c @ 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 71f01a834820
children
comparison
equal deleted inserted replaced
16:4f81b959a5f5 17:830af7de3403
214 if (!S_ISREG(st.st_mode)) { 214 if (!S_ISREG(st.st_mode)) {
215 close(fd); 215 close(fd);
216 fprintf(stderr, "error: %s is not a regular file\n", filename); 216 fprintf(stderr, "error: %s is not a regular file\n", filename);
217 return; 217 return;
218 } 218 }
219 if (!st.st_size) {
220 close(fd);
221 fprintf(stderr, "error: %s is an empty file\n", filename);
222 return;
223 }
219 if (st.st_size % 160) { 224 if (st.st_size % 160) {
220 close(fd); 225 close(fd);
221 fprintf(stderr, 226 fprintf(stderr,
222 "error: size of %s is not a multiple of 160 bytes\n", 227 "error: size of %s is not a multiple of 160 bytes\n",
223 filename); 228 filename);
256 } 261 }
257 fstat(fd, &st); 262 fstat(fd, &st);
258 if (!S_ISREG(st.st_mode)) { 263 if (!S_ISREG(st.st_mode)) {
259 close(fd); 264 close(fd);
260 fprintf(stderr, "error: %s is not a regular file\n", filename); 265 fprintf(stderr, "error: %s is not a regular file\n", filename);
266 return;
267 }
268 if (!st.st_size) {
269 close(fd);
270 fprintf(stderr, "error: %s is an empty file\n", filename);
261 return; 271 return;
262 } 272 }
263 if (st.st_size % 160) { 273 if (st.st_size % 160) {
264 close(fd); 274 close(fd);
265 fprintf(stderr, 275 fprintf(stderr,