shithub: riscv

Download patch

ref: 52c1f712ecdeb7e02e8c4a4bc1bd5146898b277d
parent: f51f73bdca8b2dcb268a9a2edef4da95e2de738f
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Fri Nov 14 18:36:18 EST 2014

upas/fs: handle cwfs "file is locked" error message

--- a/sys/src/cmd/upas/fs/plan9.c
+++ b/sys/src/cmd/upas/fs/plan9.c
@@ -182,11 +182,13 @@
 	fd = open(mb->path, OREAD);
 	if(fd < 0){
 		rerrstr(err, sizeof(err));
-		if(strstr(err, "exclusive lock") != 0 && n++ < 20){
-			sleep(500);	/* wait for lock to go away */
-			goto retry;
-		}
-		if(strstr(err, "exist") != 0){
+		if(strstr(err, "file is locked") != nil
+		|| strstr(err, "exclusive lock") != nil)
+			if(n++ < 20){
+				sleep(500);	/* wait for lock to go away */
+				goto retry;
+			}
+		if(strstr(err, "exist") != nil){
 			tmp = s_copy(mb->path);
 			s_append(tmp, ".tmp");
 			if(sysrename(s_to_c(tmp), mb->path) == 0){