From 240c884095f7ffbe2c9958032b7584136e45e63c Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Mon, 24 Apr 2017 20:38:30 +0200
Subject: import patch from version 1.1.1


diff --git a/src/basedir.c b/src/basedir.c
index 68ab879..7506f55 100644
--- a/src/basedir.c
+++ b/src/basedir.c
@@ -569,9 +569,9 @@ static char * xdgGetRelativeHome(const char *envname, const char *relativefallba
 	char *relhome;
 	if (!(relhome = xdgEnvDup(envname)) && errno != ENOMEM)
 	{
-		errno = 0;
 		const char *home;
 		unsigned int homelen;
+		errno = 0;
 		if (!(home = xdgGetEnv("HOME")))
 			return NULL;
 		if (!(relhome = (char*)malloc((homelen = strlen(home))+fallbacklength))) return NULL;
diff --git a/tests/testquery.c b/tests/testquery.c
index 53c8e6e..7f4945e 100644
--- a/tests/testquery.c
+++ b/tests/testquery.c
@@ -49,6 +49,7 @@ int main(int argc, char *argv[])
 {
 	if (argc < 3)
 		return 1;
+	{
 	char *datatype = argv[1];
 	char *querytype = argv[2];
 	if (strcmp(datatype, "data") == 0)
@@ -98,4 +99,5 @@ int main(int argc, char *argv[])
 	else
 		return 1;
 	return 0;
+	}
 }
-- 
2.7.0

