Fix use of uninitialized variable 'now' in afs_preselect()
[paraslash.git] / afs.c
diff --git a/afs.c b/afs.c
index a73b18e0596427dd2c24a31c4668d42c708ce572..6dac43d79a61a8d3b7d041c406af2eed61b14028 100644 (file)
--- a/afs.c
+++ b/afs.c
@@ -313,7 +313,7 @@ static struct timeval *afs_compute_timeout(void)
        if (chk_barrier("eof", &now, &eof_barrier, &the_timeout, 1) < 0)
                return &the_timeout;
        if (chk_barrier("data send", &now, &data_send_barrier,
-                        &the_timeout, 1) < 0)
+                       &the_timeout, 1) < 0)
                return &the_timeout;
        if (mmd->audio_format < 0 || !afs_playing() || !audio_file)
                return NULL;
@@ -398,10 +398,9 @@ again:
                        senders[i].shutdown_clients();
                if (af) {
                        struct timeval now;
-                       if (!afs_paused() || mmd->chunks_sent) {
-                               gettimeofday(&now, NULL);
+                       gettimeofday(&now, NULL);
+                       if (!afs_paused() || mmd->chunks_sent)
                                tv_add(&af->eof_tv, &now, &eof_barrier);
-                       }
                        if (afs_repos())
                                tv_add(&now, &announce_tv, &data_send_barrier);
                        if (mmd->new_afs_status_flags & AFS_NOMORE)
@@ -415,7 +414,7 @@ again:
                mmd->new_afs_status_flags &= ~(AFS_REPOS);
                mmd->current_chunk = mmd->repos_request;
        }
-       ret = afs_compute_timeout(); 
+       ret = afs_compute_timeout();
        if (!ret && !audio_file && afs_playing() &&
                        !(mmd->new_afs_status_flags & AFS_NOMORE)) {
                PARA_DEBUG_LOG("%s", "ready and playing, but no audio file\n");