diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Utils/xfuncs.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Utils/xfuncs.cpp b/lib/Utils/xfuncs.cpp index 60c2eb4f..c8aee376 100644 --- a/lib/Utils/xfuncs.cpp +++ b/lib/Utils/xfuncs.cpp @@ -246,3 +246,9 @@ void xstat(const char *name, struct stat *stat_buf) if (stat(name, stat_buf)) perror_msg_and_die("can't stat '%s'", name); } + +std::string get_home_dir(int uid) +{ + struct passwd* pw = getpwuid(uid); + return pw ? pw->pw_dir : ""; +} |