shithub: mq

Download patch

ref: cde78938f73fa85df040c8078c77d1bffc0c2132
parent: a6b7e55c1f68a95cd28512a2dd31390da8351b8a
author: kvik <kvik@a-b.xyz>
date: Sat Sep 12 17:06:54 EDT 2020

mq-cat: close the fd that got eof

--- a/src/mq-cat.c
+++ b/src/mq-cat.c
@@ -64,8 +64,10 @@
 		for(i = 0, s = streams; i < ns; i++, s++){
 			if(strcmp(s->name, name) != 0 || s->fd == -1)
 				continue;
-			if(rdwr(s->fd, 1) == 0)
+			if(rdwr(s->fd, 1) == 0){
+				close(s->fd);
 				s->fd = -1;
+			}
 			break;
 		}
 	}