diff options
| author | jvoisin | 2021-05-09 22:55:36 +0200 |
|---|---|---|
| committer | jvoisin | 2021-05-09 22:56:05 +0200 |
| commit | d934db81cdcd64086c8867bb422bfa7e0d18bb38 (patch) | |
| tree | 5e612004b6d20c00d08e31f81dff5596da47f30f | |
| parent | c3115fc26daebd0fa7135c202154272e42fbfcfd (diff) | |
strtok/strtok_r is a thing from the past, don't use it.
| -rw-r--r-- | src/snuffleupagus.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/snuffleupagus.c b/src/snuffleupagus.c index f360a0c..f0737b4 100644 --- a/src/snuffleupagus.c +++ b/src/snuffleupagus.c | |||
| @@ -250,14 +250,15 @@ static PHP_INI_MH(OnUpdateConfiguration) { | |||
| 250 | return FAILURE; | 250 | return FAILURE; |
| 251 | } | 251 | } |
| 252 | 252 | ||
| 253 | glob_t globbuf; | 253 | char *str = new_value->val; |
| 254 | char *config_file; | ||
| 255 | char *rest = new_value->val; | ||
| 256 | 254 | ||
| 257 | while ((config_file = strtok_r(rest, ",", &rest))) { | 255 | while (1) { |
| 258 | int ret = glob(config_file, GLOB_NOCHECK, NULL, &globbuf); | 256 | // We don't care about overwriting new_value->val |
| 257 | char *config_file = strsep(&str, ","); | ||
| 258 | if (config_file == NULL) break; | ||
| 259 | 259 | ||
| 260 | if (ret != 0) { | 260 | glob_t globbuf; |
| 261 | if (0 != glob(config_file, GLOB_NOCHECK, NULL, &globbuf)) { | ||
| 261 | SNUFFLEUPAGUS_G(is_config_valid) = SP_CONFIG_INVALID; | 262 | SNUFFLEUPAGUS_G(is_config_valid) = SP_CONFIG_INVALID; |
| 262 | globfree(&globbuf); | 263 | globfree(&globbuf); |
| 263 | return FAILURE; | 264 | return FAILURE; |
