diff --git a/docs/IPFS.md b/docs/IPFS.md
index e369fffc75..24bba8b75a 100644
--- a/docs/IPFS.md
+++ b/docs/IPFS.md
@@ -69,7 +69,7 @@ If you trust this behavior from your gateway of choice then passing the `-L` opt
Depending on the arguments, cURL could present the user with an error.
### Gateway file and environment variable
-cURL tried to look for the file: `~/.ipfs/gateway` but couldn't find it. It also tried to look for the `IPFS_GATEWAY` environment variable but couldn't find that either. This happens when no extra arguments are passed to cURL and letting it try to figure it out [automatically](#Automatic-gateway-detection).
+cURL tried to look for the file: `~/.ipfs/gateway` but couldn't find it. It also tried to look for the `IPFS_GATEWAY` environment variable but couldn't find that either. This happens when no extra arguments are passed to cURL and letting it try to figure it out [automatically](#automatic-gateway-detection).
Any IPFS implementation that has gateway support should expose it's URL in `~/.ipfs/gateway`. If you are already running a gateway, make sure it exposes the file where cURL expects to find it.
diff --git a/src/tool_ipfs.c b/src/tool_ipfs.c
index 271fff2cd8..435d1697ce 100644
--- a/src/tool_ipfs.c
+++ b/src/tool_ipfs.c
@@ -104,7 +104,8 @@ static char *ipfs_gateway(void)
/* get the first line of the gateway file, ignore the rest */
while((c = getc(gateway_file)) != EOF && c != '\n' && c != '\r') {
- if(curlx_dyn_addn(&dyn, &c, 1))
+ char c_char = (char)c;
+ if(curlx_dyn_addn(&dyn, &c_char, 1))
goto fail;
}
diff --git a/tests/data/test736 b/tests/data/test736
index bdf5e842ec..45d9a055a8 100644
--- a/tests/data/test736
+++ b/tests/data/test736
@@ -31,11 +31,10 @@ Hello curl from IPFS
http
-HOME=%PWD/%LOGDIR
-IPFS_DATA=$HOME/.ipfs
+IPFS_PATH=%LOGDIR/.ipfs
-IPFS with IPFS_DATA set, no traling slash
+IPFS with IPFS_PATH set, no trailing slash
ipfs://bafybeidecnvkrygux6uoukouzps5ofkeevoqland7kopseiod6pzqvjg7u
diff --git a/tests/data/test737 b/tests/data/test737
index 709a93078a..bc6e8576a4 100644
--- a/tests/data/test737
+++ b/tests/data/test737
@@ -31,11 +31,10 @@ Hello curl from IPFS
http
-HOME=%PWD/%LOGDIR
-IPFS_DATA=$HOME/.ipfs/
+IPFS_PATH=%LOGDIR/.ipfs/
-IPFS with IPFS_DATA set, with traling slash
+IPFS with IPFS_PATH set, with trailing slash
ipfs://bafybeidecnvkrygux6uoukouzps5ofkeevoqland7kopseiod6pzqvjg7u
diff --git a/tests/data/test738 b/tests/data/test738
index b6691cfcf1..5c05137dc3 100644
--- a/tests/data/test738
+++ b/tests/data/test738
@@ -17,11 +17,10 @@ IPFS
http
-HOME=%PWD/%LOGDIR
-IPFS_DATA=%HOME/.ipfs/
+IPFS_PATH=%LOGDIR/.ipfs/
-IPFS with IPFS_DATA, no gateway file
+IPFS with IPFS_PATH, no gateway file
ipfs://bafybeidecnvkrygux6uoukouzps5ofkeevoqland7kopseiod6pzqvjg7u