git: 9front

Download patch

ref: bbb3da961dc38a2e9cee18c93df9113b9f403842
parent: c4ef2b3b61a0cdacc606dc6964ca37fc03fb71a9
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Wed May 4 14:53:31 EDT 2016

webfs: fix "fd out of range" error message

--- a/sys/src/cmd/webfs/http.c
+++ b/sys/src/cmd/webfs/http.c
@@ -122,14 +122,15 @@
 		snprint(addr, sizeof(addr), "tcp!%s!%s",
 			proxy->host, proxy->port ? proxy->port : proxy->scheme);
 
-	if((fd = dial(addr, 0, 0, &ctl)) >= 0){
-		if(proxy){
-			if(strcmp(proxy->scheme, "https") == 0)
-				fd = tlswrap(fd, proxy->host);
-		} else {
-			if(strcmp(u->scheme, "https") == 0)
-				fd = tlswrap(fd, u->host);
-		}
+	if((fd = dial(addr, 0, 0, &ctl)) < 0)
+		return nil;
+
+	if(proxy){
+		if(strcmp(proxy->scheme, "https") == 0)
+			fd = tlswrap(fd, proxy->host);
+	} else {
+		if(strcmp(u->scheme, "https") == 0)
+			fd = tlswrap(fd, u->host);
 	}
 	if(fd < 0){
 		close(ctl);
--