diff options
author | Karel Zak | 2016-11-07 11:43:12 +0100 |
---|---|---|
committer | Karel Zak | 2016-11-09 10:02:32 +0100 |
commit | a5c4535b0df9e122025d804b27831dc1d38c73a9 (patch) | |
tree | 6220b237c28a80b0076e9cf1352324762495ff77 /sys-utils/chmem.c | |
parent | tests: add x86_64-16g lsmem test (diff) | |
download | kernel-qcow2-util-linux-a5c4535b0df9e122025d804b27831dc1d38c73a9.tar.gz kernel-qcow2-util-linux-a5c4535b0df9e122025d804b27831dc1d38c73a9.tar.xz kernel-qcow2-util-linux-a5c4535b0df9e122025d804b27831dc1d38c73a9.zip |
lsmem: add Copyright
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/chmem.c')
-rw-r--r-- | sys-utils/chmem.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sys-utils/chmem.c b/sys-utils/chmem.c index cc681b84c..14f5aa48d 100644 --- a/sys-utils/chmem.c +++ b/sys-utils/chmem.c @@ -17,7 +17,6 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ - #include <stdio.h> #include <unistd.h> #include <stdlib.h> @@ -78,6 +77,7 @@ static int chmem_size(struct chmem_desc *desc, int enable) size = desc->size; onoff = enable ? "online" : "offline"; i = enable ? 0 : desc->ndirs - 1; + for (; i >= 0 && i < desc->ndirs && size; i += enable ? 1 : -1) { name = desc->dirs[i]->d_name; index = strtou64_or_err(name + 6, _("Failed to parse index")); @@ -123,6 +123,7 @@ static int chmem_range(struct chmem_desc *desc, int enable) todo = desc->end - desc->start + 1; onoff = enable ? "online" : "offline"; + for (i = 0; i < desc->ndirs; i++) { name = desc->dirs[i]->d_name; index = strtou64_or_err(name + 6, _("Failed to parse index")); |