summaryrefslogtreecommitdiffstats
path: root/sys-utils/lscpu.c
diff options
context:
space:
mode:
authorPetr Uzel2012-04-23 10:43:38 +0200
committerKarel Zak2012-04-23 14:05:29 +0200
commit14e8be8ab3db2d782484af9363d6adc351b95a0b (patch)
tree4e94da9deb35f3084114662f833a447d5a412b98 /sys-utils/lscpu.c
parentlibblkid: befs: declare functions static (diff)
downloadkernel-qcow2-util-linux-14e8be8ab3db2d782484af9363d6adc351b95a0b.tar.gz
kernel-qcow2-util-linux-14e8be8ab3db2d782484af9363d6adc351b95a0b.tar.xz
kernel-qcow2-util-linux-14e8be8ab3db2d782484af9363d6adc351b95a0b.zip
lscpu: fix possibly undefined operation
With -Wall -Werror, compilation of lscpu.c fails with: Making all in sys-utils make[2]: Entering directory `/home/petr/upstream/util-linux/sys-utils' gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -include ../config.h -I../include -DLOCALEDIR=\"/usr/share/locale\" -fsigned-char -Wall -Werror -MT lscpu.o -MD -MP -MF .deps/lscpu.Tpo -c -o lscpu.o lscpu.c lscpu.c: In function ‘print_parsable’: lscpu.c:971:7: error: operation on ‘p’ may be undefined [-Werror=sequence-point] cc1: all warnings being treated as errors Fix by splitting the pointer increment to separate statement. Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
Diffstat (limited to 'sys-utils/lscpu.c')
-rw-r--r--sys-utils/lscpu.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index a4994b0cc..1adc92bad 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -967,8 +967,10 @@ print_parsable(struct lscpu_desc *desc, int cols[], int ncols,
*/
char *p = data + 1;
- while (p && *p != '\0')
- *p++ = tolower((unsigned int) *p);
+ while (p && *p != '\0') {
+ *p = tolower((unsigned int) *p);
+ p++;
+ }
}
fputs(data && *data ? data : "", stdout);
}