I created a fifo using this: mkfifo("myfifo", 0666);
Now, I want to open it using inf fd = open("./myfifo",O_WRONLY);
but that sends me to an infinite loop, why?
Asked
Active
Viewed 778 times
1

CIsForCookies
- 12,097
- 11
- 59
- 124
1 Answers
4
From the fifo(7)
man page:
The FIFO must be opened on both ends (reading and writing) before data can be passed. Normally, opening the FIFO blocks until the other end is opened also.
What you have there is not an infinite loop. Your process is just blocked waiting for something to open the other end of the pipe.

Mat
- 202,337
- 40
- 393
- 406
-
Actually there was another file that indeed opened the fifo for reading, but as it turns out, it was corrupted. But thanks anyway – CIsForCookies Jun 01 '14 at 12:58