From 91b0d53f8835bd274997eddb28b74ebc5ef00340 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 17 Feb 2019 15:07:24 +0100 Subject: [PATCH] filenames can exceed 128 bytes, even in testcases --- src/datacache/perf_datacache.c | 4 ++-- src/datacache/test_datacache.c | 4 ++-- src/datacache/test_datacache_quota.c | 4 ++-- src/datastore/perf_datastore_api.c | 4 ++-- src/datastore/perf_plugin_datastore.c | 6 +++--- src/datastore/test_datastore_api.c | 10 +++++----- src/datastore/test_datastore_api_management.c | 6 +++--- src/datastore/test_plugin_datastore.c | 6 +++--- src/include/platform.h | 12 +++++++++++- src/namecache/test_plugin_namecache.c | 4 ++-- src/namestore/test_plugin_namestore.c | 8 -------- src/peerstore/test_plugin_peerstore.c | 4 ++-- 12 files changed, 37 insertions(+), 35 deletions(-) diff --git a/src/datacache/perf_datacache.c b/src/datacache/perf_datacache.c index f33e62bae..4381171c5 100644 --- a/src/datacache/perf_datacache.c +++ b/src/datacache/perf_datacache.c @@ -11,7 +11,7 @@ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . @@ -132,7 +132,7 @@ FAILURE: int main (int argc, char *argv[]) { - char cfg_name[128]; + char cfg_name[PATH_MAX]; char *const xargv[] = { "perf-datacache", "-c", diff --git a/src/datacache/test_datacache.c b/src/datacache/test_datacache.c index e647ae833..d62a31c27 100644 --- a/src/datacache/test_datacache.c +++ b/src/datacache/test_datacache.c @@ -11,7 +11,7 @@ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . @@ -155,7 +155,7 @@ FAILURE: int main (int argc, char *argv[]) { - char cfg_name[128]; + char cfg_name[PATH_MAX]; char *const xargv[] = { "test-datacache", "-c", diff --git a/src/datacache/test_datacache_quota.c b/src/datacache/test_datacache_quota.c index 117d8be4e..7c4e56ea5 100644 --- a/src/datacache/test_datacache_quota.c +++ b/src/datacache/test_datacache_quota.c @@ -11,7 +11,7 @@ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . @@ -123,7 +123,7 @@ int main (int argc, char *argv[]) { - char cfg_name[128]; + char cfg_name[PATH_MAX]; char *const xargv[] = { "test-datacache-quota", "-c", diff --git a/src/datastore/perf_datastore_api.c b/src/datastore/perf_datastore_api.c index 939e60e4d..2c261b155 100644 --- a/src/datastore/perf_datastore_api.c +++ b/src/datastore/perf_datastore_api.c @@ -11,7 +11,7 @@ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . @@ -595,7 +595,7 @@ int main (int argc, char *argv[]) { - char cfg_name[128]; + char cfg_name[PATH_MAX]; plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]); GNUNET_snprintf (cfg_name, diff --git a/src/datastore/perf_plugin_datastore.c b/src/datastore/perf_plugin_datastore.c index 9ba8fa1b0..f68d1f389 100644 --- a/src/datastore/perf_plugin_datastore.c +++ b/src/datastore/perf_plugin_datastore.c @@ -11,7 +11,7 @@ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . @@ -519,8 +519,8 @@ run (void *cls, char *const *args, const char *cfgfile, int main (int argc, char *argv[]) { - char dir_name[128]; - char cfg_name[128]; + char dir_name[PATH_MAX]; + char cfg_name[PATH_MAX]; char *const xargv[] = { "perf-plugin-datastore", "-c", diff --git a/src/datastore/test_datastore_api.c b/src/datastore/test_datastore_api.c index fa96ea9b7..daf6cccb3 100644 --- a/src/datastore/test_datastore_api.c +++ b/src/datastore/test_datastore_api.c @@ -11,7 +11,7 @@ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . @@ -635,7 +635,7 @@ duc_dummy (void *cls, /** - * check if plugin is actually working + * check if plugin is actually working */ static int test_plugin (const char *cfg_name) @@ -644,7 +644,7 @@ test_plugin (const char *cfg_name) struct GNUNET_CONFIGURATION_Handle *cfg; struct GNUNET_DATASTORE_PluginFunctions *api; struct GNUNET_DATASTORE_PluginEnvironment env; - + cfg = GNUNET_CONFIGURATION_create (); if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, @@ -691,9 +691,9 @@ int main (int argc, char *argv[]) { - char cfg_name[128]; + char cfg_name[PATH_MAX]; int ret; - + plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]); GNUNET_snprintf (cfg_name, sizeof (cfg_name), diff --git a/src/datastore/test_datastore_api_management.c b/src/datastore/test_datastore_api_management.c index d592ccc80..d91fe748b 100644 --- a/src/datastore/test_datastore_api_management.c +++ b/src/datastore/test_datastore_api_management.c @@ -11,7 +11,7 @@ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . @@ -337,7 +337,7 @@ ignore_payload_cb (void *cls, static int test_plugin (const char *cfg_name) { - char libname[128]; + char libname[PATH_MAX]; struct GNUNET_CONFIGURATION_Handle *cfg; struct GNUNET_DATASTORE_PluginFunctions *api; struct GNUNET_DATASTORE_PluginEnvironment env; @@ -378,7 +378,7 @@ test_plugin (const char *cfg_name) int main (int argc, char *argv[]) { - char cfg_name[128]; + char cfg_name[PATH_MAX]; int ret; plugin_name = GNUNET_TESTING_get_testname_from_underscore (argv[0]); diff --git a/src/datastore/test_plugin_datastore.c b/src/datastore/test_plugin_datastore.c index 4b054314c..c37b8ddb9 100644 --- a/src/datastore/test_plugin_datastore.c +++ b/src/datastore/test_plugin_datastore.c @@ -11,7 +11,7 @@ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . @@ -436,8 +436,8 @@ run (void *cls, char *const *args, const char *cfgfile, int main (int argc, char *argv[]) { - char dir_name[128]; - char cfg_name[128]; + char dir_name[PATH_MAX]; + char cfg_name[PATH_MAX]; char *const xargv[] = { "test-plugin-datastore", "-c", diff --git a/src/include/platform.h b/src/include/platform.h index 1bae7ca44..01b0bcf9e 100644 --- a/src/include/platform.h +++ b/src/include/platform.h @@ -11,7 +11,7 @@ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . @@ -281,4 +281,14 @@ atoll (const char *nptr); */ #define GNUNET_TERM_SIG SIGTERM + +#ifndef PATH_MAX +/** + * Assumed maximum path length. + */ +#define PATH_MAX 4096 +#endif + + + #endif diff --git a/src/namecache/test_plugin_namecache.c b/src/namecache/test_plugin_namecache.c index c2a630a46..20900a3f6 100644 --- a/src/namecache/test_plugin_namecache.c +++ b/src/namecache/test_plugin_namecache.c @@ -11,7 +11,7 @@ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . @@ -102,7 +102,7 @@ run (void *cls, char *const *args, const char *cfgfile, int main (int argc, char *argv[]) { - char cfg_name[128]; + char cfg_name[PATH_MAX]; char *const xargv[] = { "test-plugin-namecache", "-c", diff --git a/src/namestore/test_plugin_namestore.c b/src/namestore/test_plugin_namestore.c index ff1f83780..30778ed69 100644 --- a/src/namestore/test_plugin_namestore.c +++ b/src/namestore/test_plugin_namestore.c @@ -194,14 +194,6 @@ run (void *cls, } -#ifndef PATH_MAX -/** - * Assumed maximum path length (for the configuration file name). - */ -#define PATH_MAX 4096 -#endif - - int main (int argc, char *argv[]) diff --git a/src/peerstore/test_plugin_peerstore.c b/src/peerstore/test_plugin_peerstore.c index 5f18d1532..d6be5f06d 100644 --- a/src/peerstore/test_plugin_peerstore.c +++ b/src/peerstore/test_plugin_peerstore.c @@ -11,7 +11,7 @@ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . @@ -188,7 +188,7 @@ run (void *cls, int main (int argc, char *argv[]) { - char cfg_name[128]; + char cfg_name[PATH_MAX]; char *const xargv[] = { "test-plugin-peerstore", "-c", -- 2.25.1