}
-static int make_tmp_subdir(const char *parent, char **ret) {
- _cleanup_free_ char *y = NULL;
-
- y = path_join(parent, "/tmp");
- if (!y)
- return -ENOMEM;
-
- RUN_WITH_UMASK(0000) {
- if (mkdir(y, 0777 | S_ISVTX) < 0)
- return -errno;
- }
-
- if (ret)
- *ret = TAKE_PTR(y);
- return 0;
-}
-
static int setup_one_tmp_dir(const char *id, const char *prefix, char **path, char **tmp_path) {
_cleanup_free_ char *x = NULL;
+ _cleanup_free_ char *y = NULL;
char bid[SD_ID128_STRING_MAX];
sd_id128_t boot_id;
bool rw = true;
}
if (rw) {
- r = make_tmp_subdir(x, tmp_path);
+ y = strjoin(x, "/tmp");
+ if (!y)
+ return -ENOMEM;
+
+ RUN_WITH_UMASK(0000) {
+ if (mkdir(y, 0777 | S_ISVTX) < 0)
+ return -errno;
+ }
+
+ r = label_fix_container(y, prefix, 0);
if (r < 0)
return r;
+
+ if (tmp_path)
+ *tmp_path = TAKE_PTR(y);
} else {
/* Trouble: we failed to create the directory. Instead of failing, let's simulate /tmp being
* read-only. This way the service will get the EROFS result as if it was writing to the real