char *filename;
int fd;
+ bool do_unlink_fifo;
size_t buffer_size;
size_t bytes_dropped;
bool fifo_error;
u->write_type = 0;
u->filename = pa_runtime_path(pa_modargs_get_value(ma, "file", DEFAULT_FILE_NAME));
+ u->do_unlink_fifo = false;
if (mkfifo(u->filename, 0666) < 0) {
- pa_log("mkfifo('%s'): %s", u->filename, pa_cstrerror(errno));
- goto fail;
- }
+ if (errno != EEXIST) {
+ pa_log("mkfifo('%s'): %s", u->filename, pa_cstrerror(errno));
+ goto fail;
+ }
+ } else
+ u->do_unlink_fifo = true;
+
if ((u->fd = pa_open_cloexec(u->filename, O_RDWR, 0)) < 0) {
pa_log("open('%s'): %s", u->filename, pa_cstrerror(errno));
goto fail;
pa_rtpoll_free(u->rtpoll);
if (u->filename) {
- unlink(u->filename);
+ if (u->do_unlink_fifo)
+ unlink(u->filename);
pa_xfree(u->filename);
}