[PATCH xserver 3/3] test: Fix sizeof expression.
msrb at suse.com
msrb at suse.com
Mon Mar 27 12:03:39 UTC 2017
From: Michal Srb <msrb at suse.com>
Instead of getting (sizeof(char[10]) - 1) = 9 it was getting sizeof(char*) = 8. Not that it changes much.
simple-xinit.c:90:65: warning: sizeof on pointer operation will return size of 'char *' instead of 'char [10]' [-Wsizeof-array-decay]
ret = read(displayfd, display_string, sizeof(display_string - 1));
~~~~~~~~~~~~~~ ^
---
test/simple-xinit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/simple-xinit.c b/test/simple-xinit.c
index 89189a6..e93f85c 100644
--- a/test/simple-xinit.c
+++ b/test/simple-xinit.c
@@ -87,7 +87,7 @@ get_display(int displayfd)
char display_string[10];
ssize_t ret;
- ret = read(displayfd, display_string, sizeof(display_string - 1));
+ ret = read(displayfd, display_string, sizeof(display_string) - 1);
if (ret <= 0) {
fprintf(stderr, "Failed reading displayfd: %s\n", strerror(errno));
exit(1);
--
2.10.2
More information about the xorg-devel
mailing list