aboutsummaryrefslogtreecommitdiff
path: root/src/shared/helpers.h
diff options
context:
space:
mode:
authorAnna (navi) Figueiredo Gomes <navi@vlhl.dev>2024-07-18 17:29:21 +0200
committerAnna (navi) Figueiredo Gomes <navi@vlhl.dev>2024-07-20 03:15:17 +0200
commitc3ccaeeddc4d92bfe34cedaa6b71cb6e830fe280 (patch)
tree926df7c4c604381f4d7b7b9ebccfa13bacefa3d7 /src/shared/helpers.h
parent18be0d77dc00d2e9faa7d8718e80a2f137ec0bf7 (diff)
librc, openrc-pam: instantiate user.<username> service automatically
it's created in /run/openrc/dynamic and linked to the service in /etc at login. Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
Diffstat (limited to 'src/shared/helpers.h')
-rw-r--r--src/shared/helpers.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/shared/helpers.h b/src/shared/helpers.h
index dee41b75..36a25a2d 100644
--- a/src/shared/helpers.h
+++ b/src/shared/helpers.h
@@ -91,6 +91,22 @@ RC_UNUSED static char *xstrdup(const char *str)
/* NOTREACHED */
}
+RC_UNUSED static char *xstrndup(const char *str, size_t n)
+{
+ char *value;
+
+ if (!str)
+ return (NULL);
+
+ value = strndup(str, n);
+
+ if (value)
+ return (value);
+
+ ERRX;
+ /* NOTREACHED */
+}
+
#undef ERRX
/*