Skip to contentSkip to conversation

Fix const qualifier error

PATCH In review [email protected] 2 participants 3 messages Dec 19, 2024 – Jan 3, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix const qualifier error

From: Wang Mingyu <[email protected]>

erroe message:
cc -DHAVE_CONFIG_H -I. -I../../support/include -I/usr/include/tirpc -I/usr/include/libxml2 -D_GNU_SOURCE -pipe -Wall -Wextra -Werror=strict-prototypes -Werror=missing-prototypes -Werror=missing-declarations -Werror=format=2 -Werror=undef -Werror=missing-include-dirs -Werror=strict-aliasing=2 -Werror=init-self -Werror=implicit-function-declaration -Werror=return-type -Werror=switch -Werror=overflow -Werror=parentheses -Werror=aggregate-return -Werror=unused-result -fno-strict-aliasing -Werror=format-overflow=2 -Werror=int-conversion -Werror=incompatible-pointer-types -Werror=misleading-indentation -Wno-cast-function-type -g -O2 -MT file.o -MD -MP -MF .deps/file.Tpo -c -o file.o file.c file.c: In function ‘nsm_make_temp_pathname’:
file.c:200:22: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
200 | base = pathname;
| ^

---
 support/nsm/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
support/nsm/file.c +1 -1
index de122b0f..27332108 100644
@@ -197,7 +197,7 @@ nsm_make_temp_pathname(const char *pathname)
 
 	base = strrchr(pathname, '/');
 	if (base == NULL)
-		base = pathname;
+		base = (char*)(&pathname);
 	else
 		base++;
 
Signature · 1 line
2.43.0
#1 lore raw
Quoted 1 line · On 12/19/24 3:42 AM, [email protected] wrote:

From: Wang Mingyu <[email protected]>

Committed... (tag: nfs-utils-2-8-3-rc1)

steved.

Quoted 26 lines

erroe message:
cc -DHAVE_CONFIG_H -I. -I../../support/include -I/usr/include/tirpc -I/usr/include/libxml2 -D_GNU_SOURCE -pipe -Wall -Wextra -Werror=strict-prototypes -Werror=missing-prototypes -Werror=missing-declarations -Werror=format=2 -Werror=undef -Werror=missing-include-dirs -Werror=strict-aliasing=2 -Werror=init-self -Werror=implicit-function-declaration -Werror=return-type -Werror=switch -Werror=overflow -Werror=parentheses -Werror=aggregate-return -Werror=unused-result -fno-strict-aliasing -Werror=format-overflow=2 -Werror=int-conversion -Werror=incompatible-pointer-types -Werror=misleading-indentation -Wno-cast-function-type -g -O2 -MT file.o -MD -MP -MF .deps/file.Tpo -c -o file.o file.c file.c: In function ‘nsm_make_temp_pathname’:
file.c:200:22: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
200 | base = pathname;
| ^

---
  support/nsm/file.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
support/nsm/file.c +1 -1
index de122b0f..27332108 100644
@@ -197,7 +197,7 @@ nsm_make_temp_pathname(const char *pathname)
 
  	base = strrchr(pathname, '/');
  	if (base == NULL)
-		base = pathname;
+		base = (char*)(&pathname);
  	else
  		base++;
 
#2 lore raw
In reply to [email protected]
Quoted 1 line · On 12/19/24 3:42 AM, [email protected] wrote:

From: Wang Mingyu <[email protected]>

Committed... (tag: nfs-utils-2-8-3-rc1)

steved.

Quoted 26 lines

erroe message:
cc -DHAVE_CONFIG_H -I. -I../../support/include -I/usr/include/tirpc -I/usr/include/libxml2 -D_GNU_SOURCE -pipe -Wall -Wextra -Werror=strict-prototypes -Werror=missing-prototypes -Werror=missing-declarations -Werror=format=2 -Werror=undef -Werror=missing-include-dirs -Werror=strict-aliasing=2 -Werror=init-self -Werror=implicit-function-declaration -Werror=return-type -Werror=switch -Werror=overflow -Werror=parentheses -Werror=aggregate-return -Werror=unused-result -fno-strict-aliasing -Werror=format-overflow=2 -Werror=int-conversion -Werror=incompatible-pointer-types -Werror=misleading-indentation -Wno-cast-function-type -g -O2 -MT file.o -MD -MP -MF .deps/file.Tpo -c -o file.o file.c file.c: In function ‘nsm_make_temp_pathname’:
file.c:200:22: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
200 | base = pathname;
| ^

---
  support/nsm/file.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
support/nsm/file.c +1 -1
index de122b0f..27332108 100644
@@ -197,7 +197,7 @@ nsm_make_temp_pathname(const char *pathname)
 
  	base = strrchr(pathname, '/');
  	if (base == NULL)
-		base = pathname;
+		base = (char*)(&pathname);
  	else
  		base++;