shithub: zuke

Download patch

ref: 74e64942e26b41965b6921d40d5174eeab41b048
parent: f6bfcbd29e0d9644719b5dcbab9866eb2143bb2b
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Mon Dec 28 09:47:19 EST 2020

QLock → Lock; add more flags to rfork

--- a/zuke.c
+++ b/zuke.c
@@ -62,7 +62,7 @@
 static Rectangle seekbar;
 static int seekmx, newseekmx;
 static double seekoff; /* ms */
-static QLock audiolock;
+static Lock audiolock;
 static int audioerr = 0;
 static Biobuf out;
 static char *covers[] = {"art", "folder", "cover", "Cover", "scans/CD", "Scans/Front", "Covers/Front"};
@@ -84,22 +84,22 @@
 static void
 audioon(void)
 {
-	qlock(&audiolock);
+	lock(&audiolock);
 	if(audio < 0 && (audio = open("/dev/audio", OWRITE|OCEXEC)) < 0 && audioerr == 0){
 		fprint(2, "%r\n");
 		audioerr = 1;
 	}
-	qunlock(&audiolock);
+	unlock(&audiolock);
 }
 
 static void
 audiooff(void)
 {
-	qlock(&audiolock);
+	lock(&audiolock);
 	close(audio);
 	audio = -1;
 	audioerr = 0;
-	qunlock(&audiolock);
+	unlock(&audiolock);
 }
 
 #pragma varargck type "P" uvlong
@@ -412,7 +412,7 @@
 		seek(fd, m->imageoffset, 0);
 	}
 	pipe(p);
-	if((pid = rfork(RFPROC|RFFDG|RFREND|RFNOTEG)) == 0){
+	if((pid = rfork(RFPROC|RFFDG|RFNOTEG|RFNOMNT|RFCENVG|RFNOWAIT)) == 0){
 		dup(fd, 0); close(fd);
 		dup(p[1], 1); close(p[1]);
 		if(!debug) {
@@ -531,7 +531,8 @@
 	}
 
 	pipe(p);
-	if((pid = rfork(RFPROC|RFFDG|RFREND|RFNOTEG)) == 0){
+	if((pid = rfork(RFPROC|RFFDG|RFNOTEG|RFNOMNT|RFCENVG|RFNOWAIT)) == 0){
+		close(p[1]);
 		if(fd < 0)
 			fd = open("/dev/null", OREAD);
 		dup(fd, 0); close(fd);
@@ -540,7 +541,6 @@
 			dup(fd = open("/dev/null", OWRITE), 2);
 			close(fd);
 		}
-		close(p[1]);
 		if(*fmt){
 			snprint(cmd, sizeof(cmd), "/bin/audio/%sdec", fmt);
 			snprint(seekpos, sizeof(seekpos), "%g", (double)boffset/Bps);