[Sheepdog] varies printf type typo

Liu Yuan namei.unix at gmail.com
Wed Feb 29 10:29:36 CET 2012


On 02/29/2012 04:18 PM, huxinwei wrote:

> Hi list,
> 
>   I found several printf related type errors in 32-bit linux environment.
>   Here's the trivial patch to fix them.
> 
>   FYI.
> 
> diff --git a/collie/common.c b/collie/common.c
> index 32ba0b6..f4301c4 100644
> --- a/collie/common.c
> +++ b/collie/common.c
> @@ -68,12 +68,12 @@ int sd_read_object(uint64_t oid, void *data, unsigned int datalen,
>  	close(fd);
>  
>  	if (ret) {
> -		fprintf(stderr, "Failed to read object %lx\n", oid);
> +		fprintf(stderr, "Failed to read object %" PRIx64 "\n", oid);
>  		return SD_RES_EIO;
>  	}
>  
>  	if (rsp->result != SD_RES_SUCCESS) {
> -		fprintf(stderr, "Failed to read object %lx %s\n", oid,
> +		fprintf(stderr, "Failed to read object %" PRIx64 " %s\n", oid,
>  			sd_strerror(rsp->result));
>  		return rsp->result;
>  	}
> @@ -112,11 +112,11 @@ int sd_write_object(uint64_t oid, uint64_t cow_oid, void *data, unsigned int dat
>  	close(fd);
>  
>  	if (ret) {
> -		fprintf(stderr, "Failed to write object %lx\n", oid);
> +		fprintf(stderr, "Failed to write object %" PRIx64 "\n", oid);
>  		return SD_RES_EIO;
>  	}
>  	if (rsp->result != SD_RES_SUCCESS) {
> -		fprintf(stderr, "Failed to write object %lx: %s\n", oid,
> +		fprintf(stderr, "Failed to write object %" PRIx64 ": %s\n", oid,
>  				sd_strerror(rsp->result));
>  		return rsp->result;
>  	}
> diff --git a/sheep/store.c b/sheep/store.c
> index 4d90923..256feae 100644
> --- a/sheep/store.c
> +++ b/sheep/store.c
> @@ -1614,7 +1614,7 @@ static int request_obj_list(struct sd_node *e, uint32_t epoch,
>  		return -1;
>  	}
>  
> -	dprintf("%lu\n", rsp->data_length / sizeof(uint64_t));
> +	dprintf("%"PRIu32"\n", rsp->data_length / sizeof(uint64_t));
>  


Thanks, applied. I fixed a warning by changing PRIu32 into PRIu64 for
this line. and I append your sign-off(huxinwei <huxinwei at huawei.com>) to
the patch.

Thanks,
Yuan




More information about the sheepdog mailing list