Commit 7db12406 authored by Max Kellermann's avatar Max Kellermann

ConfigPath: use std::string

parent 39e2ffe2
...@@ -99,12 +99,11 @@ ParsePath(const char *path, Error &error) ...@@ -99,12 +99,11 @@ ParsePath(const char *path, Error &error)
++path; ++path;
} else { } else {
const char *slash = strchr(path, '/'); const char *slash = strchr(path, '/');
char *user = slash != nullptr const char *end = slash == nullptr
? g_strndup(path, slash - path) ? path + strlen(path)
: g_strdup(path); : slash;
const std::string user(path, end);
home = GetHome(user, error); home = GetHome(user.c_str(), error);
g_free(user);
if (slash == nullptr) if (slash == nullptr)
return home; return home;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment