On Tue, 28 Sep 2010, Tamas TEVESZ wrote:

 > ugh, except in a few cases where i forgot.
 > 
 > fix coming up soon, thanks.

>From 9723ac2d5fe30b7ab6c98101a8da00e9058bb2da Mon Sep 17 00:00:00 2001
From: Tamas TEVESZ <[email protected]>
Date: Tue, 28 Sep 2010 20:06:50 +0200
Subject: [PATCH] Repair wgethomedir(), broken a little while back

Signed-off-by: Tamas TEVESZ <[email protected]>
---
 WINGs/findfile.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/WINGs/findfile.c b/WINGs/findfile.c
index 3ffa2ca..2d826cf 100644
--- a/WINGs/findfile.c
+++ b/WINGs/findfile.c
@@ -36,14 +36,17 @@
 char *wgethomedir()
 {
        static char *home = NULL;
+       char *tmp;
        struct passwd *user;
 
        if (home)
                return home;
 
-       home = getenv("HOME");
-       if (home)
+       tmp = getenv("HOME");
+       if (tmp) {
+               home = wstrdup(tmp);
                return home;
+       }
 
        user = getpwuid(getuid());
        if (!user) {
-- 
1.7.0.4


-- 
[-]

mkdir /nonexistent
From 9723ac2d5fe30b7ab6c98101a8da00e9058bb2da Mon Sep 17 00:00:00 2001
From: Tamas TEVESZ <[email protected]>
Date: Tue, 28 Sep 2010 20:06:50 +0200
Subject: [PATCH] Repair wgethomedir(), broken a little while back

Signed-off-by: Tamas TEVESZ <[email protected]>
---
 WINGs/findfile.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/WINGs/findfile.c b/WINGs/findfile.c
index 3ffa2ca..2d826cf 100644
--- a/WINGs/findfile.c
+++ b/WINGs/findfile.c
@@ -36,14 +36,17 @@
 char *wgethomedir()
 {
 	static char *home = NULL;
+	char *tmp;
 	struct passwd *user;
 
 	if (home)
 		return home;
 
-	home = getenv("HOME");
-	if (home)
+	tmp = getenv("HOME");
+	if (tmp) {
+		home = wstrdup(tmp);
 		return home;
+	}
 
 	user = getpwuid(getuid());
 	if (!user) {
-- 
1.7.0.4

Reply via email to