>From e513b8d56e19226c60b2ed262fdab3819268c0cc Mon Sep 17 00:00:00 2001
From: Tamas TEVESZ <[email protected]>
Date: Tue, 28 Sep 2010 03:39:31 +0200
Subject: [PATCH] Plug potential segfault, following up on d65cb5a
Signed-off-by: Tamas TEVESZ <[email protected]>
---
WINGs/userdefaults.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/WINGs/userdefaults.c b/WINGs/userdefaults.c
index ea5cceb..cb2cc05 100644
--- a/WINGs/userdefaults.c
+++ b/WINGs/userdefaults.c
@@ -51,20 +51,20 @@ char *wusergnusteppath()
char *gspath;
int pathlen;
- if (!path) {
- gspath = getenv("GNUSTEP_USER_ROOT");
+ gspath = getenv("GNUSTEP_USER_ROOT");
+ if (gspath) {
+ gspath = wexpandpath(gspath);
if (gspath) {
- gspath = wexpandpath(gspath);
pathlen = strlen(gspath) + 4;
path = wmalloc(pathlen);
strcpy(path, gspath);
wfree(gspath);
- } else {
- pathlen = strlen(wgethomedir()) + 10;
- path = wmalloc(pathlen);
- strcpy(path, wgethomedir());
- strcat(path, "/GNUstep");
}
+ } else {
+ pathlen = strlen(wgethomedir()) + 10;
+ path = wmalloc(pathlen);
+ strcpy(path, wgethomedir());
+ strcat(path, "/GNUstep");
}
return path;
--
1.7.0.4
--
[-]
mkdir /nonexistentFrom e513b8d56e19226c60b2ed262fdab3819268c0cc Mon Sep 17 00:00:00 2001
From: Tamas TEVESZ <[email protected]>
Date: Tue, 28 Sep 2010 03:39:31 +0200
Subject: [PATCH] Plug potential segfault, following up on d65cb5a
Signed-off-by: Tamas TEVESZ <[email protected]>
---
WINGs/userdefaults.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/WINGs/userdefaults.c b/WINGs/userdefaults.c
index ea5cceb..cb2cc05 100644
--- a/WINGs/userdefaults.c
+++ b/WINGs/userdefaults.c
@@ -51,20 +51,20 @@ char *wusergnusteppath()
char *gspath;
int pathlen;
- if (!path) {
- gspath = getenv("GNUSTEP_USER_ROOT");
+ gspath = getenv("GNUSTEP_USER_ROOT");
+ if (gspath) {
+ gspath = wexpandpath(gspath);
if (gspath) {
- gspath = wexpandpath(gspath);
pathlen = strlen(gspath) + 4;
path = wmalloc(pathlen);
strcpy(path, gspath);
wfree(gspath);
- } else {
- pathlen = strlen(wgethomedir()) + 10;
- path = wmalloc(pathlen);
- strcpy(path, wgethomedir());
- strcat(path, "/GNUstep");
}
+ } else {
+ pathlen = strlen(wgethomedir()) + 10;
+ path = wmalloc(pathlen);
+ strcpy(path, wgethomedir());
+ strcat(path, "/GNUstep");
}
return path;
--
1.7.0.4