commit 9cf2843ffc80e285148f21af8176ecdd562b2490
parent 18f23c8074bdfe3f218776db29669d0a1d599517
Author: Wim Dupont <wim@wimdupont.com>
Date: Wed, 14 Jan 2026 15:07:59 +0100
cleanup
Diffstat:
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/cpc.c b/cpc.c
@@ -118,20 +118,16 @@ parse_json_object(const char *json_string)
char *
replace_home(char *buf, const char *path)
{
- char *userhome, *envv = "$HOME";
+ char *envv = "$HOME";
struct passwd userinf;
- userinf = *getpwuid(getuid());
- userhome = strdup(userinf.pw_dir);
-
if ((strstr(path, envv) != NULL)) {
- cpstr(buf, userhome);
+ userinf = *getpwuid(getuid());
+ cpstr(buf, userinf.pw_dir);
strcat(buf, path + strlen(envv));
} else
cpstr(buf, path);
- free(userhome);
-
return buf;
}