mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-18 05:42:35 +00:00
Define try_chdir everywhere
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
c760019dd5
commit
bf3c3fa122
@ -442,7 +442,7 @@ static void write_outcome_result(FILE *outcome_file,
|
|||||||
*
|
*
|
||||||
* Failures are silent.
|
* Failures are silent.
|
||||||
*/
|
*/
|
||||||
static void try_chdir(const char *argv0)
|
static void try_chdir_if_supported(const char *argv0)
|
||||||
{
|
{
|
||||||
/* We might want to allow backslash as well, for Windows. But then we also
|
/* We might want to allow backslash as well, for Windows. But then we also
|
||||||
* need to consider chdir() vs _chdir(), and different conventions
|
* need to consider chdir() vs _chdir(), and different conventions
|
||||||
@ -467,6 +467,13 @@ static void try_chdir(const char *argv0)
|
|||||||
}
|
}
|
||||||
mbedtls_free(path);
|
mbedtls_free(path);
|
||||||
}
|
}
|
||||||
|
#else /* MBEDTLS_HAVE_CHDIR */
|
||||||
|
/* No chdir() or no support for parsing argv[0] on this platform. */
|
||||||
|
static void try_chdir_if_supported(const char *argv0)
|
||||||
|
{
|
||||||
|
(void) argv0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
#endif /* MBEDTLS_HAVE_CHDIR */
|
#endif /* MBEDTLS_HAVE_CHDIR */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -237,7 +237,6 @@ int main(int argc, const char *argv[])
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MBEDTLS_HAVE_CHDIR
|
|
||||||
/* Try changing to the directory containing the executable, if
|
/* Try changing to the directory containing the executable, if
|
||||||
* using the default data file. This allows running the executable
|
* using the default data file. This allows running the executable
|
||||||
* from another directory (e.g. the project root) and still access
|
* from another directory (e.g. the project root) and still access
|
||||||
@ -249,8 +248,7 @@ int main(int argc, const char *argv[])
|
|||||||
* test-specific files such as the outcome file, which is arguably
|
* test-specific files such as the outcome file, which is arguably
|
||||||
* not desirable and should be fixed later.
|
* not desirable and should be fixed later.
|
||||||
*/
|
*/
|
||||||
try_chdir(argv[0]);
|
try_chdir_if_supported(argv[0]);
|
||||||
#endif /* MBEDTLS_HAVE_CHDIR */
|
|
||||||
|
|
||||||
int ret = mbedtls_test_platform_setup();
|
int ret = mbedtls_test_platform_setup();
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user