The size argument to eal_set_runtime_dir is useless and was
being used incorrectly in strlcpy. It worked only because
all callers passed PATH_MAX which is same as sizeof the destination
runtime_dir.
Note: this is an internal API so no user exposed change.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
}
int
-eal_set_runtime_dir(char *run_dir, size_t size)
+eal_set_runtime_dir(const char *run_dir)
{
- size_t str_size;
-
- str_size = strlcpy(runtime_dir, run_dir, size);
- if (str_size >= size) {
+ if (strlcpy(runtime_dir, run_dir, PATH_MAX) >= PATH_MAX) {
RTE_LOG(ERR, EAL, "Runtime directory string too long\n");
return -1;
}
*
* @param run_dir
* The new runtime directory path of DPDK
- * @param size
- * The size of the new runtime directory path in bytes.
* @return
* 0 on success, (-1) on failure.
*/
int
-eal_set_runtime_dir(char *run_dir, size_t size);
+eal_set_runtime_dir(const char *run_dir);
/**
* Get the internal configuration structure.
return -1;
}
- if (eal_set_runtime_dir(run_dir, sizeof(run_dir)))
+ if (eal_set_runtime_dir(run_dir))
return -1;
return 0;
return -1;
}
- if (eal_set_runtime_dir(run_dir, sizeof(run_dir)))
+ if (eal_set_runtime_dir(run_dir))
return -1;
return 0;