X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=alsa_write.c;h=88e48b4524717bc832201d7e5c5cac75976abffc;hp=04a94f733aef71df6da073bfea868a47f258b32c;hb=1775d4d4147730e79e48aa941aee88580b8beb08;hpb=74c88020bd325865fe26ed25ea8ad0ace0924136 diff --git a/alsa_write.c b/alsa_write.c index 04a94f73..88e48b45 100644 --- a/alsa_write.c +++ b/alsa_write.c @@ -164,17 +164,18 @@ static int alsa_init(struct private_alsa_write_data *pad, goto fail; ret = snd_output_buffer_open(&output_log); if (ret == 0) { - char *buf; + char *buf, *p; + size_t sz; PARA_INFO_LOG("dumping alsa configuration\n"); snd_pcm_dump(pad->handle, output_log); - snd_output_buffer_string(output_log, &buf); - for (;;) { - char *p = strchr(buf, '\n'); - if (!p) /* omit last output line, it's empty */ + sz = snd_output_buffer_string(output_log, &buf); + for (p = buf; p < buf + sz;) { + char *q = memchr(p, '\n', buf + sz - p); + if (!q) break; - *p = '\0'; - PARA_INFO_LOG("%s\n", buf); - buf = p + 1; + *q = '\0'; + PARA_INFO_LOG("%s\n", p); + p = q + 1; } snd_output_close(output_log); } @@ -357,7 +358,7 @@ void alsa_write_init(struct writer *w) alsa_write_cmdline_parser_init(&dummy); w->close = alsa_close; w->pre_select = alsa_write_pre_select; - w->new_post_select = alsa_write_post_select; + w->post_select = alsa_write_post_select; w->parse_config_or_die = alsa_parse_config_or_die; w->free_config = alsa_free_config; w->help = (struct ggo_help) {