Starting from
cfbf7538d87023840c5574fa5b0452e5b0f42149 we'd always
install the credentials dir regardless of whether it's empty,
with the correct permissions. Hence the problem stated in the comment
should no longer be a concern. Moreover, this ensures later in
setup_namespace() the mountpoint would be in-place. This is important
for credential reloading as it saves the trouble of remounting
the upper tmpfs as rw again and create the mountpoint.
return r;
r = setup_credentials_internal(context, cgroup_context, params, unit, p, uid, gid);
+ if (r < 0)
+ (void) rmdir(p);
- /* If the credentials dir is empty and not a mount point, then there's no point in having it. Let's
- * try to remove it. This matters in particular if we created the dir as mount point but then didn't
- * actually end up mounting anything on it. In that case we'd rather have ENOENT than EACCESS being
- * seen by users when trying access this inode. */
- (void) rmdir(p);
return r;
}
.mode = MOUNT_BIND,
.read_only = true,
.source_const = p->creds_path,
- .ignore = true,
};
}