diff mbox series

[v2] Fix typecast warning with clang

Message ID 20241219191212.530007-1-raj.khem@gmail.com (mailing list archive)
State Handled Elsewhere, archived
Headers show
Series [v2] Fix typecast warning with clang | expand

Commit Message

Khem Raj Dec. 19, 2024, 7:12 p.m. UTC
Fixes
file.c:200:8: error: assigning to 'char *' from 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: Benjamin Coddington <bcodding@redhat.com>
Cc: Steve Dickson <steved@redhat.com>
---
v2: Make base as const char pointer insread of trying type punning

 support/nsm/file.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Steve Dickson Jan. 3, 2025, 9:33 p.m. UTC | #1
On 12/19/24 2:12 PM, Khem Raj wrote:
> Fixes
> file.c:200:8: error: assigning to 'char *' from 'const char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
> 
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> Cc: Benjamin Coddington <bcodding@redhat.com>
> Cc: Steve Dickson <steved@redhat.com>
Committed... (tag: nfs-utils-2-8-3-rc1)

steved.
> ---
> v2: Make base as const char pointer insread of trying type punning
> 
>   support/nsm/file.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/support/nsm/file.c b/support/nsm/file.c
> index de122b0f..68f99bf0 100644
> --- a/support/nsm/file.c
> +++ b/support/nsm/file.c
> @@ -184,7 +184,8 @@ static char *
>   nsm_make_temp_pathname(const char *pathname)
>   {
>   	size_t size;
> -	char *path, *base;
> +	char *path;
> +	const char *base;
>   	int len;
>   
>   	size = strlen(pathname) + sizeof(".new") + 1;
>
diff mbox series

Patch

diff --git a/support/nsm/file.c b/support/nsm/file.c
index de122b0f..68f99bf0 100644
--- a/support/nsm/file.c
+++ b/support/nsm/file.c
@@ -184,7 +184,8 @@  static char *
 nsm_make_temp_pathname(const char *pathname)
 {
 	size_t size;
-	char *path, *base;
+	char *path;
+	const char *base;
 	int len;
 
 	size = strlen(pathname) + sizeof(".new") + 1;