aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/cgroup.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/cgroup.cc')
-rw-r--r--src/libstore/cgroup.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libstore/cgroup.cc b/src/libstore/cgroup.cc
index 0ae45e46d..5d31609da 100644
--- a/src/libstore/cgroup.cc
+++ b/src/libstore/cgroup.cc
@@ -53,7 +53,10 @@ void destroyCgroup(const Path & cgroup)
for (auto & pid_s : pids) {
pid_t pid;
- if (!string2Int(pid_s, pid)) throw Error("invalid pid '%s'", pid);
+ if (auto o = string2Int<pid_t>(pid_s))
+ pid = *o;
+ else
+ throw Error("invalid pid '%s'", pid);
if (pidsShown.insert(pid).second) {
try {
auto cmdline = readFile(fmt("/proc/%d/cmdline", pid));