[ltt-dev] [PATCH 2/2] Fix lttd's compile warning on fc9

Mathieu Desnoyers compudj at krystal.dyndns.org
Tue Nov 25 01:37:07 EST 2008


* Zhaolei (zhaolei at cn.fujitsu.com) wrote:
> Hi,
> 
> Fixed following compile warning:
> 
> gcc -DHAVE_CONFIG_H -I.. -I..     -g -O2 -MT lttd.o -MD -MP -MF .deps/lttd.Tpo -c -o lttd.o lttd.c
> lttd.c: In function 'read_subbuffer':
> lttd.c:467: warning: passing argument 2 of 'splice' from incompatible pointer type
> 
> It can be fixed by following patch. Applies on top of ltt-control-0.58-23112008.
> 
> Signed-off-by: Zhao Lei <zhaolei at cn.fujitsu.com>
> ---
> diff -Nur ltt-control-0.58-23112008.org/lttd/lttd.c ltt-control-0.58-23112008/lttd/lttd.c
> --- ltt-control-0.58-23112008.org/lttd/lttd.c	2008-11-25 13:52:02.000000000 +0800
> +++ ltt-control-0.58-23112008/lttd/lttd.c	2008-11-25 13:51:46.000000000 +0800
> @@ -463,8 +463,8 @@
>  	offset = 0;
>  	while (len > 0) {
>  		printf_verbose("splice chan to pipe offset %lu\n", offset);
> -		ret = splice(pair->channel, &offset, thread_pipe[1], NULL,
> -			len, SPLICE_F_MOVE);
> +		ret = splice(pair->channel, (off_t *)&offset, thread_pipe[1],

Hrm, nope, if off_t is defined as a 32-bits type and the machine is big
endian and has 64-bits unsigned long (I doubt it ever happens, but let's
play on the safe side), the value will become erroneous. The correct fix
is to declare offset as an off_t. I'll fix it in the next release.
Thanks !

Mathieu

> +			NULL, len, SPLICE_F_MOVE);
>  		printf_verbose("splice chan to pipe ret %ld\n", ret);
>  		if (ret < 0) {
>  			perror("Error in relay splice");
> 
> 
> _______________________________________________
> ltt-dev mailing list
> ltt-dev at lists.casi.polymtl.ca
> http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
> 

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68




More information about the lttng-dev mailing list