|
| 1 | +From b309f5d40619f033bbddef5c95682beed31659ac Mon Sep 17 00:00:00 2001 |
| 2 | +From: Rudi Heitbaum <rudi@heitbaum.com> |
| 3 | +Date: Mon, 26 Jan 2026 11:55:03 +0000 |
| 4 | +Subject: [PATCH] fix initialization discards 'const' qualifier from pointer |
| 5 | + target type |
| 6 | + |
| 7 | +Since glibc-2.43: |
| 8 | + |
| 9 | +For ISO C23, the functions bsearch, memchr, strchr, strpbrk, strrchr, |
| 10 | +strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr that return |
| 11 | +pointers into their input arrays now have definitions as macros that |
| 12 | +return a pointer to a const-qualified type when the input argument is |
| 13 | +a pointer to a const-qualified type. |
| 14 | + |
| 15 | +https://lists.gnu.org/archive/html/info-gnu/2026-01/msg00005.html |
| 16 | + |
| 17 | +Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com> |
| 18 | +--- |
| 19 | + lib/hgfs/hgfsEscape.c | 6 +++--- |
| 20 | + lib/hgfsServer/hgfsServerLinux.c | 2 +- |
| 21 | + lib/misc/strutil.c | 7 ++++--- |
| 22 | + lib/nicInfo/nicInfoPosix.c | 2 +- |
| 23 | + libvmtools/i18n.c | 2 +- |
| 24 | + services/plugins/vix/vixTools.c | 2 +- |
| 25 | + 6 files changed, 11 insertions(+), 10 deletions(-) |
| 26 | + |
| 27 | +diff --git a/lib/hgfs/hgfsEscape.c b/lib/hgfs/hgfsEscape.c |
| 28 | +index c4d39b12..212ea1c7 100644 |
| 29 | +--- a/lib/hgfs/hgfsEscape.c |
| 30 | ++++ b/lib/hgfs/hgfsEscape.c |
| 31 | +@@ -175,7 +175,7 @@ HgfsAddEscapeCharacter(char const * bufIn, // IN: input name |
| 32 | + HgfsEscapeContext *escapeContext = (HgfsEscapeContext *)context; |
| 33 | + uint32 charactersToCopy; |
| 34 | + uint32 outputSpace; |
| 35 | +- char* illegal; |
| 36 | ++ const char* illegal; |
| 37 | + Bool result = TRUE; |
| 38 | + |
| 39 | + ASSERT(offset >= escapeContext->processedOffset); // Scanning forward |
| 40 | +@@ -573,7 +573,7 @@ HgfsIsEscapeSequence(char const *bufIn, // IN: input name |
| 41 | + uint32 length) // IN: length of the name in characters |
| 42 | + { |
| 43 | + if (bufIn[offset] == HGFS_ESCAPE_CHAR && offset > 0) { |
| 44 | +- char *substitute; |
| 45 | ++ const char *substitute; |
| 46 | + if (bufIn[offset - 1] == HGFS_ESCAPE_SUBSTITUE_CHAR && offset > 1) { |
| 47 | + /* |
| 48 | + * Possibly a valid sequence, check it must be preceded with a substitute |
| 49 | +@@ -887,7 +887,7 @@ HgfsEscapeUndoComponent(char *bufIn, // IN: Characters to be unesc |
| 50 | + size_t offset = escapePointer - bufIn; |
| 51 | + |
| 52 | + if (HgfsIsEscapeSequence(bufIn, offset, sizeIn)) { |
| 53 | +- char* substitute = strchr(HGFS_SUBSTITUTE_CHARS, bufIn[offset - 1]); |
| 54 | ++ const char* substitute = strchr(HGFS_SUBSTITUTE_CHARS, bufIn[offset - 1]); |
| 55 | + if (substitute != NULL) { |
| 56 | + bufIn[offset - 1] = HGFS_ILLEGAL_CHARS[substitute - HGFS_SUBSTITUTE_CHARS]; |
| 57 | + } else if (bufIn[offset - 1] == HGFS_ESCAPE_SUBSTITUE_CHAR) { |
| 58 | +diff --git a/lib/hgfsServer/hgfsServerLinux.c b/lib/hgfsServer/hgfsServerLinux.c |
| 59 | +index 4a0bc937..fd1db4a2 100644 |
| 60 | +--- a/lib/hgfsServer/hgfsServerLinux.c |
| 61 | ++++ b/lib/hgfsServer/hgfsServerLinux.c |
| 62 | +@@ -1364,7 +1364,7 @@ static void |
| 63 | + HgfsGetHiddenAttr(char const *fileName, // IN: Input filename |
| 64 | + HgfsFileAttrInfo *attr) // OUT: Struct to copy into |
| 65 | + { |
| 66 | +- char *baseName; |
| 67 | ++ const char *baseName; |
| 68 | + |
| 69 | + ASSERT(fileName); |
| 70 | + ASSERT(attr); |
| 71 | +diff --git a/lib/misc/strutil.c b/lib/misc/strutil.c |
| 72 | +index 4fc6502e..4be63b7b 100644 |
| 73 | +--- a/lib/misc/strutil.c |
| 74 | ++++ b/lib/misc/strutil.c |
| 75 | +@@ -1454,6 +1454,7 @@ StrUtil_ReplaceAll(const char *orig, // IN |
| 76 | + char *result; |
| 77 | + const char *current; |
| 78 | + char *tmp; |
| 79 | ++ const char *tmp2; |
| 80 | + size_t lenWhat; |
| 81 | + size_t lenWith; |
| 82 | + size_t occurrences = 0; |
| 83 | +@@ -1467,8 +1468,8 @@ StrUtil_ReplaceAll(const char *orig, // IN |
| 84 | + lenWith = strlen(with); |
| 85 | + |
| 86 | + current = orig; |
| 87 | +- while ((tmp = strstr(current, what)) != NULL) { |
| 88 | +- current = tmp + lenWhat; |
| 89 | ++ while ((tmp2 = strstr(current, what)) != NULL) { |
| 90 | ++ current = tmp2 + lenWhat; |
| 91 | + ++occurrences; |
| 92 | + } |
| 93 | + |
| 94 | +@@ -1695,7 +1696,7 @@ StrUtilHasListItem(char const *list, // IN: |
| 95 | + char const *item, // IN: |
| 96 | + int (*ncmp)(char const *, char const*, size_t)) // IN: |
| 97 | + { |
| 98 | +- char *foundDelim; |
| 99 | ++ const char *foundDelim; |
| 100 | + int itemLen = strlen(item); |
| 101 | + |
| 102 | + if (list == NULL) { |
| 103 | +diff --git a/lib/nicInfo/nicInfoPosix.c b/lib/nicInfo/nicInfoPosix.c |
| 104 | +index 0135e6a0..922b4efe 100644 |
| 105 | +--- a/lib/nicInfo/nicInfoPosix.c |
| 106 | ++++ b/lib/nicInfo/nicInfoPosix.c |
| 107 | +@@ -263,7 +263,7 @@ static Bool |
| 108 | + IpEntryMatchesDevice(const char *devName, |
| 109 | + const char *label) |
| 110 | + { |
| 111 | +- char *p; |
| 112 | ++ const char *p; |
| 113 | + size_t n; |
| 114 | + |
| 115 | + if ((p = strchr(label, ':')) != NULL) { |
| 116 | +diff --git a/libvmtools/i18n.c b/libvmtools/i18n.c |
| 117 | +index 3085f72d..f61406d1 100644 |
| 118 | +--- a/libvmtools/i18n.c |
| 119 | ++++ b/libvmtools/i18n.c |
| 120 | +@@ -698,7 +698,7 @@ VMTools_BindTextDomain(const char *domain, |
| 121 | + * If we couldn't find the catalog file for the user's language, see if |
| 122 | + * we can find a more generic language (e.g., for "en_US", also try "en"). |
| 123 | + */ |
| 124 | +- char *sep = Str_Strrchr(lang, '_'); |
| 125 | ++ const char *sep = Str_Strrchr(lang, '_'); |
| 126 | + if (sep != NULL) { |
| 127 | + if (usrlang == NULL) { |
| 128 | + usrlang = Util_SafeStrdup(lang); |
| 129 | +diff --git a/services/plugins/vix/vixTools.c b/services/plugins/vix/vixTools.c |
| 130 | +index 654512c5..5c79ca12 100644 |
| 131 | +--- a/services/plugins/vix/vixTools.c |
| 132 | ++++ b/services/plugins/vix/vixTools.c |
| 133 | +@@ -930,7 +930,7 @@ VixToolsBuildUserEnvironmentTable(const char * const *envp) // IN: optional |
| 134 | + for (; NULL != *envp; envp++) { |
| 135 | + char *name; |
| 136 | + char *value; |
| 137 | +- char *whereToSplit; |
| 138 | ++ const char *whereToSplit; |
| 139 | + size_t nameLen; |
| 140 | + |
| 141 | + whereToSplit = strchr(*envp, '='); |
| 142 | +-- |
| 143 | +2.51.0 |
| 144 | + |
0 commit comments