]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix gcc 4.3.2 rpm build
authorMichael Jerris <mike@jerris.com>
Fri, 6 Feb 2009 19:01:31 +0000 (19:01 +0000)
committerMichael Jerris <mike@jerris.com>
Fri, 6 Feb 2009 19:01:31 +0000 (19:01 +0000)
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@651 a93c3328-9c30-0410-af19-c9cd2b2d52af

libs/freetdm/src/testtones.c

index 2097f26df5b8c238b791162c4099a49111bc1b77..273b793acf4ab4f7345803dfcae6d66b6b2ed538 100644 (file)
@@ -8,9 +8,13 @@ static int teletone_handler(teletone_generation_session_t *ts, teletone_tone_map
 {
        struct ttmp *tmp = ts->user_data;
        int wrote;
+       size_t len;
 
        wrote = teletone_mux_tones(ts, map);
-       write(tmp->fd, ts->buffer, wrote * 2);
+       len = write(tmp->fd, ts->buffer, wrote * 2);
+       
+       if (!len) return -1;
+
        return 0;
 }
 
@@ -49,6 +53,7 @@ int32_t main(int argc, char *argv[])
        int32_t durations[] = {274, 274, 380, 0};
        teletone_dds_state_t dds = {0};
        int16_t sample;
+       size_t len = 1;
 
        if (argc < 2 || (fd = open(argv[1], O_WRONLY | O_TRUNC | O_CREAT, S_IRUSR | S_IWUSR)) < 0) {
                fprintf(stderr, "File Error!\n", strerror(errno));
@@ -59,9 +64,9 @@ int32_t main(int argc, char *argv[])
 
                teletone_dds_state_set_tone(&dds, tones[j], rate, -50);
                
-               for(i = 0; i < durations[j] * rate / 1000; i++) {
+               for(i = 0; (i < durations[j] * rate / 1000) && len != 0; i++) {
                        sample = teletone_dds_modulate_sample(&dds) * 20;
-                       write(fd, &sample, sizeof(sample));
+                       len = write(fd, &sample, sizeof(sample));
                }
 
        }