summaryrefslogtreecommitdiffstats
path: root/lib/Utils/xfuncs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Utils/xfuncs.cpp')
-rw-r--r--lib/Utils/xfuncs.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/Utils/xfuncs.cpp b/lib/Utils/xfuncs.cpp
index 97c2f76..4b208a9 100644
--- a/lib/Utils/xfuncs.cpp
+++ b/lib/Utils/xfuncs.cpp
@@ -368,3 +368,14 @@ bool string_to_bool(const char *s)
return true;
return false;
}
+
+bool xgetpwnam(const char* login, uid_t *uid)
+{
+ struct passwd* pwd = getpwnam(login);
+ if (pwd == NULL)
+ return false;
+
+ *uid = pwd->pw_uid;
+ return true;
+}
+