chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cgroup: it's not OK to invoke alloca() in loops
[elogind.git]
/
src
/
core
/
mount-setup.c
diff --git
a/src/core/mount-setup.c
b/src/core/mount-setup.c
index c601c9742c7d3fd249a54d59093b01f075c61c2a..c6d3f4bbcc7142d6b41c9d6647762caf04028e4b 100644
(file)
--- a/
src/core/mount-setup.c
+++ b/
src/core/mount-setup.c
@@
-43,10
+43,7
@@
#include "virt.h"
#include "efivars.h"
#include "smack-util.h"
#include "virt.h"
#include "efivars.h"
#include "smack-util.h"
-
-#ifndef TTY_GID
-#define TTY_GID 5
-#endif
+#include "def.h"
typedef enum MountMode {
MNT_NONE = 0,
typedef enum MountMode {
MNT_NONE = 0,
@@
-219,10
+216,10
@@
int mount_setup_early(void) {
}
int mount_cgroup_controllers(char ***join_controllers) {
}
int mount_cgroup_controllers(char ***join_controllers) {
- int r;
- char buf[LINE_MAX];
_cleanup_set_free_free_ Set *controllers = NULL;
_cleanup_fclose_ FILE *f;
_cleanup_set_free_free_ Set *controllers = NULL;
_cleanup_fclose_ FILE *f;
+ char buf[LINE_MAX];
+ int r;
/* Mount all available cgroup controllers that are built into the kernel. */
/* Mount all available cgroup controllers that are built into the kernel. */
@@
-265,6
+262,7
@@
int mount_cgroup_controllers(char ***join_controllers) {
}
for (;;) {
}
for (;;) {
+ _cleanup_free_ char *options = NULL, *controller = NULL, *where = NULL;
MountPoint p = {
.what = "cgroup",
.type = "cgroup",
MountPoint p = {
.what = "cgroup",
.type = "cgroup",
@@
-272,7
+270,6
@@
int mount_cgroup_controllers(char ***join_controllers) {
.mode = MNT_IN_CONTAINER,
};
char ***k = NULL;
.mode = MNT_IN_CONTAINER,
};
char ***k = NULL;
- _cleanup_free_ char *options = NULL, *controller;
controller = set_steal_first(controllers);
if (!controller)
controller = set_steal_first(controllers);
if (!controller)
@@
-289,7
+286,7
@@
int mount_cgroup_controllers(char ***join_controllers) {
for (i = *k, j = *k; *i; i++) {
if (!streq(*i, controller)) {
for (i = *k, j = *k; *i; i++) {
if (!streq(*i, controller)) {
-
char _cleanup_free_
*t;
+
_cleanup_free_ char
*t;
t = set_remove(controllers, *i);
if (!t) {
t = set_remove(controllers, *i);
if (!t) {
@@
-311,7
+308,11
@@
int mount_cgroup_controllers(char ***join_controllers) {
controller = NULL;
}
controller = NULL;
}
- p.where = strappenda("/sys/fs/cgroup/", options);
+ where = strappend("/sys/fs/cgroup/", options);
+ if (!where)
+ return log_oom();
+
+ p.where = where;
p.options = options;
r = mount_one(&p, true);
p.options = options;
r = mount_one(&p, true);
@@
-322,7
+323,11
@@
int mount_cgroup_controllers(char ***join_controllers) {
char **i;
for (i = *k; *i; i++) {
char **i;
for (i = *k; *i; i++) {
- char *t = strappenda("/sys/fs/cgroup/", *i);
+ _cleanup_free_ char *t = NULL;
+
+ t = strappend("/sys/fs/cgroup/", *i);
+ if (!t)
+ return log_oom();
r = symlink(options, t);
if (r < 0 && errno != EEXIST) {
r = symlink(options, t);
if (r < 0 && errno != EEXIST) {