char *t;
int r;
+ assert(ret);
assert(text);
assert(table);
int specifier_string(char specifier, const void *data, const char *root, const void *userdata, char **ret) {
char *n = NULL;
+ assert(ret);
+
if (!isempty(data)) {
n = strdup(data);
if (!n)
int specifier_real_path(char specifier, const void *data, const char *root, const void *userdata, char **ret) {
const char *path = data;
+ assert(ret);
+
if (!path)
return -ENOENT;
_cleanup_free_ char *path = NULL;
int r;
+ assert(ret);
+
r = specifier_real_path(specifier, data, root, userdata, &path);
if (r < 0)
return r;
char *n;
int r;
+ assert(ret);
+
if (root) {
_cleanup_close_ int fd = -1;
char *n;
int r;
+ assert(ret);
+
r = sd_id128_get_boot(&id);
if (r < 0)
return r;
int specifier_host_name(char specifier, const void *data, const char *root, const void *userdata, char **ret) {
char *n;
+ assert(ret);
+
n = gethostname_malloc();
if (!n)
return -ENOMEM;
int specifier_short_host_name(char specifier, const void *data, const char *root, const void *userdata, char **ret) {
char *n;
+ assert(ret);
+
n = gethostname_short_malloc();
if (!n)
return -ENOMEM;
struct utsname uts;
char *n;
+ assert(ret);
+
if (uname(&uts) < 0)
return -errno;
int specifier_architecture(char specifier, const void *data, const char *root, const void *userdata, char **ret) {
char *t;
+ assert(ret);
+
t = strdup(architecture_to_string(uname_architecture()));
if (!t)
return -ENOMEM;
* otherwise. We'll return an empty value or NULL in that case from the functions below. */
int specifier_os_id(char specifier, const void *data, const char *root, const void *userdata, char **ret) {
+ assert(ret);
return parse_os_release(root, "ID", ret);
}
int specifier_os_version_id(char specifier, const void *data, const char *root, const void *userdata, char **ret) {
+ assert(ret);
return parse_os_release(root, "VERSION_ID", ret);
}
int specifier_os_build_id(char specifier, const void *data, const char *root, const void *userdata, char **ret) {
+ assert(ret);
return parse_os_release(root, "BUILD_ID", ret);
}
int specifier_os_variant_id(char specifier, const void *data, const char *root, const void *userdata, char **ret) {
+ assert(ret);
return parse_os_release(root, "VARIANT_ID", ret);
}
int specifier_os_image_id(char specifier, const void *data, const char *root, const void *userdata, char **ret) {
+ assert(ret);
return parse_os_release(root, "IMAGE_ID", ret);
}
int specifier_os_image_version(char specifier, const void *data, const char *root, const void *userdata, char **ret) {
+ assert(ret);
return parse_os_release(root, "IMAGE_VERSION", ret);
}
int specifier_group_name(char specifier, const void *data, const char *root, const void *userdata, char **ret) {
char *t;
+ assert(ret);
+
t = gid_to_name(getgid());
if (!t)
return -ENOMEM;
}
int specifier_group_id(char specifier, const void *data, const char *root, const void *userdata, char **ret) {
+ assert(ret);
+
if (asprintf(ret, UID_FMT, getgid()) < 0)
return -ENOMEM;
int specifier_user_name(char specifier, const void *data, const char *root, const void *userdata, char **ret) {
char *t;
+ assert(ret);
+
/* If we are UID 0 (root), this will not result in NSS, otherwise it might. This is good, as we want to be able
* to run this in PID 1, where our user ID is 0, but where NSS lookups are not allowed.
}
int specifier_user_id(char specifier, const void *data, const char *root, const void *userdata, char **ret) {
+ assert(ret);
+
if (asprintf(ret, UID_FMT, getuid()) < 0)
return -ENOMEM;
}
int specifier_user_home(char specifier, const void *data, const char *root, const void *userdata, char **ret) {
+ assert(ret);
/* On PID 1 (which runs as root) this will not result in NSS,
* which is good. See above */
}
int specifier_user_shell(char specifier, const void *data, const char *root, const void *userdata, char **ret) {
+ assert(ret);
/* On PID 1 (which runs as root) this will not result in NSS,
* which is good. See above */
char *copy;
int r;
+ assert(ret);
+
if (root) /* If root dir is set, don't honour $TMP or similar */
p = "/tmp";
else {
char *copy;
int r;
+ assert(ret);
+
if (root)
p = "/var/tmp";
else {