diff mbox series

mdadm: fix compilation failure on the x32 ABI

Message ID alpine.LRH.2.21.2211040957470.19553@file01.intranet.prod.int.rdu2.redhat.com (mailing list archive)
State Changes Requested, archived
Headers show
Series mdadm: fix compilation failure on the x32 ABI | expand

Commit Message

Mikulas Patocka Nov. 4, 2022, 2:01 p.m. UTC
Hi

Here I'm sending a patch for the mdadm utility. It fixes compile failure 
on the x32 ABI.

Mikulas


From: Mikulas Patocka <mpatocka@redhat.com>

The x32 ABI has 32-bit long and 64-bit time_t. Consequently, it reports 
printf arguments mismatch when attempting to print time using the "%ld" 
format specifier.

Fix this by converting times to long long and using %lld when printing
them.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

---
 monitor.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Mariusz Tkaczyk Nov. 17, 2022, 2:28 p.m. UTC | #1
On Fri, 4 Nov 2022 10:01:22 -0400 (EDT)
Mikulas Patocka <mpatocka@redhat.com> wrote:

> Hi
> 
> Here I'm sending a patch for the mdadm utility. It fixes compile failure 
> on the x32 ABI.
> 
> Mikulas
> 
> 
> From: Mikulas Patocka <mpatocka@redhat.com>
> 
> The x32 ABI has 32-bit long and 64-bit time_t. Consequently, it reports 
> printf arguments mismatch when attempting to print time using the "%ld" 
> format specifier.
> 
> Fix this by converting times to long long and using %lld when printing
> them.
> 
> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> 
> ---
>  monitor.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> Index: mdadm/monitor.c
> ===================================================================
> --- mdadm.orig/monitor.c	2022-11-04 14:25:52.000000000 +0100
> +++ mdadm/monitor.c	2022-11-04 14:28:05.000000000 +0100
> @@ -449,9 +449,9 @@ static int read_and_act(struct active_ar
>  	}
>  
>  	gettimeofday(&tv, NULL);
> -	dprintf("(%d): %ld.%06ld state:%s prev:%s action:%s prev: %s
> start:%llu\n",
> +	dprintf("(%d): %lld.%06lld state:%s prev:%s action:%s prev: %s
> start:%llu\n", a->info.container_member,
> -		tv.tv_sec, tv.tv_usec,
> +		(long long)tv.tv_sec, (long long)tv.tv_usec,
>  		array_states[a->curr_state],
>  		array_states[a->prev_state],
>  		sync_actions[a->curr_action],
> 
Hi Mikulas,
This is just a debug log in mdmon, feel free to remove the time totally.

Thanks,
Mariusz
Jes Sorensen Nov. 17, 2022, 2:51 p.m. UTC | #2
On 11/17/22 09:28, Mariusz Tkaczyk wrote:
> On Fri, 4 Nov 2022 10:01:22 -0400 (EDT)
> Mikulas Patocka <mpatocka@redhat.com> wrote:
> 
>> Hi
>>
>> Here I'm sending a patch for the mdadm utility. It fixes compile failure 
>> on the x32 ABI.
>>
>> Mikulas
>>
>>
>> From: Mikulas Patocka <mpatocka@redhat.com>
>>
>> The x32 ABI has 32-bit long and 64-bit time_t. Consequently, it reports 
>> printf arguments mismatch when attempting to print time using the "%ld" 
>> format specifier.
>>
>> Fix this by converting times to long long and using %lld when printing
>> them.
>>
>> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
>>
>> ---
>>  monitor.c |    4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> Index: mdadm/monitor.c
>> ===================================================================
>> --- mdadm.orig/monitor.c	2022-11-04 14:25:52.000000000 +0100
>> +++ mdadm/monitor.c	2022-11-04 14:28:05.000000000 +0100
>> @@ -449,9 +449,9 @@ static int read_and_act(struct active_ar
>>  	}
>>  
>>  	gettimeofday(&tv, NULL);
>> -	dprintf("(%d): %ld.%06ld state:%s prev:%s action:%s prev: %s
>> start:%llu\n",
>> +	dprintf("(%d): %lld.%06lld state:%s prev:%s action:%s prev: %s
>> start:%llu\n", a->info.container_member,
>> -		tv.tv_sec, tv.tv_usec,
>> +		(long long)tv.tv_sec, (long long)tv.tv_usec,
>>  		array_states[a->curr_state],
>>  		array_states[a->prev_state],
>>  		sync_actions[a->curr_action],
>>
> Hi Mikulas,
> This is just a debug log in mdmon, feel free to remove the time totally.

I second this! :)

Jes
diff mbox series

Patch

Index: mdadm/monitor.c
===================================================================
--- mdadm.orig/monitor.c	2022-11-04 14:25:52.000000000 +0100
+++ mdadm/monitor.c	2022-11-04 14:28:05.000000000 +0100
@@ -449,9 +449,9 @@  static int read_and_act(struct active_ar
 	}
 
 	gettimeofday(&tv, NULL);
-	dprintf("(%d): %ld.%06ld state:%s prev:%s action:%s prev: %s start:%llu\n",
+	dprintf("(%d): %lld.%06lld state:%s prev:%s action:%s prev: %s start:%llu\n",
 		a->info.container_member,
-		tv.tv_sec, tv.tv_usec,
+		(long long)tv.tv_sec, (long long)tv.tv_usec,
 		array_states[a->curr_state],
 		array_states[a->prev_state],
 		sync_actions[a->curr_action],