From c046e56fc5bdd6f29e16f8c1476c1bbc26efee16 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Wed, 17 Sep 2025 20:58:24 +0200 Subject: [PATCH] channel_open: always recreate the fifo Another process could have written into the in file while ii was down, creating a regular file. --- ii.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ii.c b/ii.c index c402a87..bc0895f 100644 --- a/ii.c +++ b/ii.c @@ -219,12 +219,9 @@ channel_open(Channel *c) struct stat st; /* make "in" fifo if it doesn't exist already. */ - if (lstat(c->inpath, &st) != -1) { - if (!(st.st_mode & S_IFIFO)) - return -1; - } else if (mkfifo(c->inpath, S_IRWXU)) { + unlink(c->inpath); + if (mkfifo(c->inpath, S_IRWXU)) return -1; - } c->fdin = -1; fd = open(c->inpath, O_RDONLY | O_NONBLOCK, 0); if (fd == -1) -- 2.51.0