2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 13:58:34 +00:00

cg: Minus one string copy in collect_cgroups

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
This commit is contained in:
Pavel Emelyanov 2014-07-14 17:40:13 +04:00
parent 3467c3a5eb
commit f5705fb416

View File

@ -14,6 +14,7 @@
#include "proc_parse.h"
#include "util.h"
#include "fdset.h"
#include "string.h"
#include "protobuf.h"
#include "protobuf/core.pb-c.h"
#include "protobuf/cgroup.pb-c.h"
@ -338,7 +339,7 @@ static int collect_cgroups(struct list_head *ctls)
list_for_each_entry(cc, ctls, l) {
char path[PATH_MAX];
char *name, mount_point[PATH_MAX], prefix[] = ".criu.cgmounts.XXXXXX";
char *name, prefix[] = ".criu.cgmounts.XXXXXX";
bool temp_mount = false;
struct cg_controller *cg;
@ -347,7 +348,7 @@ static int collect_cgroups(struct list_head *ctls)
else
name = cc->name;
if (get_cgroup_mount_point(name, mount_point) < 0) {
if (get_cgroup_mount_point(name, path) < 0) {
/* Someone is trying to dump a process that is in
* a controller that isn't mounted, so we mount it for
* them.
@ -373,10 +374,10 @@ static int collect_cgroups(struct list_head *ctls)
return -1;
}
strcpy(mount_point, prefix);
strcpy(path, prefix);
}
snprintf(path, PATH_MAX, "%s%s", mount_point, cc->path);
strlcat(path, cc->path, PATH_MAX);
current_controller = NULL;