summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--inc/abrtlib.h2
-rw-r--r--lib/Utils/xfuncs.cpp6
2 files changed, 8 insertions, 0 deletions
diff --git a/inc/abrtlib.h b/inc/abrtlib.h
index 8e3f1f4e..5721c6fa 100644
--- a/inc/abrtlib.h
+++ b/inc/abrtlib.h
@@ -113,4 +113,6 @@ off_t copyfd_eof(int src_fd, int dst_fd);
off_t copyfd_size(int src_fd, int dst_fd, off_t size);
void copyfd_exact_size(int src_fd, int dst_fd, off_t size);
+std::string get_home_dir(int uid);
+
#endif
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 : "";
+}