shithub: qk1

Download patch

ref: 4f4a0b78514eabbd3d5c1e86a178bd3628d37435
parent: 928de2ce5c6140c19c348ad782bfbe5fa6e35fc4
author: Konstantinn Bonnet <qu7uux@gmail.com>
date: Wed Oct 14 01:56:36 EDT 2015

cd: fix exiting on eof and writing an outdated buffer

--- a/cd.c
+++ b/cd.c
@@ -75,8 +75,11 @@
 		if(n == 0){
 			if(cdloop)
 				seek(fd, 0, 0);
-			else
-				break;
+			else{
+				close(fd);
+				fd = -1;
+			}
+			continue;
 		}
 		p = (short *)buf;
 		while((uintptr)p < (uintptr)(buf + sizeof buf)){