return 0;
}
+static int user_mkdir_system_share_path(const char *runtime_path, uid_t uid) {
+ int r;
+ gid_t system_share_gid;
+ _cleanup_free_ char *t = NULL;
+ const char *system_share_group = "system_share";
+
+ r = get_group_creds(&system_share_group, &system_share_gid, 0);
+ if (r < 0)
+ return r;
+
+ /* mount option "gid=system_share" doesn't work. So, we have to modify gid here*/
+ r = chmod_and_chown(runtime_path, 0750, uid, system_share_gid);
+ if (r < 0)
+ return log_error_errno(r, "Failed to change runtime directory ownership and mode: %m");
+
+ r = asprintf(&t, "/run/user/"UID_FMT"/system_share", uid);
+ if (r < 0)
+ return log_oom();
+
+ r = mkdir_safe_label(t, 0750, uid, system_share_gid, MKDIR_WARN_MODE);
+ if (r < 0)
+ return log_error_errno(r, "Failed to create '%s': %m", t);
+
+ return 0;
+}
+
static int user_mkdir_runtime_path(
const char *runtime_path,
uid_t uid,
r = label_fix(runtime_path, 0);
if (r < 0)
log_warning_errno(r, "Failed to fix label of \"%s\", ignoring: %m", runtime_path);
+
+ r = user_mkdir_system_share_path(runtime_path, uid);
+ if (r < 0)
+ goto fail;
}
return 0;