[lxc-devel] [PATCH 1/2] fix trivial off by one error
Dwight Engen
dwight.engen at oracle.com
Tue Sep 18 19:58:10 UTC 2012
Since the if uses >=, the - 1 is not needed and the MAXFDS'th
entry in the fds array can be used.
---
src/lxc/cgroup.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/lxc/cgroup.c b/src/lxc/cgroup.c
index a02ebc2..7bb88b5 100644
--- a/src/lxc/cgroup.c
+++ b/src/lxc/cgroup.c
@@ -398,7 +398,7 @@ int lxc_cgroup_prepare_attach(const char *name, void **data)
err = 0;
i = 0;
while ((mntent = getmntent(file))) {
- if (i >= MAXFDS - 1) {
+ if (i >= MAXFDS) {
ERROR("too many cgroups to attach to, aborting");
lxc_cgroup_dispose_attach(fds);
errno = ENOMEM;
--
1.7.1
More information about the lxc-devel
mailing list