Print a notice if chdir fails
Fixes -Wunused-result warning. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
21bff21575
commit
ca26082ab7
1 changed files with 6 additions and 7 deletions
|
@ -433,8 +433,7 @@ static void write_outcome_result(FILE *outcome_file,
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__unix__) || \
|
#if defined(__unix__) || \
|
||||||
(defined(__APPLE__) && defined(__MACH__)) || \
|
(defined(__APPLE__) && defined(__MACH__))
|
||||||
defined(_WIN32)
|
|
||||||
#define MBEDTLS_HAVE_CHDIR
|
#define MBEDTLS_HAVE_CHDIR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -456,11 +455,11 @@ static void try_chdir(const char *argv0)
|
||||||
}
|
}
|
||||||
memcpy(path, argv0, path_size - 1);
|
memcpy(path, argv0, path_size - 1);
|
||||||
path[path_size - 1] = 0;
|
path[path_size - 1] = 0;
|
||||||
#if defined(_WIN32)
|
int ret = chdir(path);
|
||||||
(void) _chdir(path);
|
if (ret != 0) {
|
||||||
#else
|
mbedtls_fprintf(stderr, "%s: note: chdir(\"%s\") failed.\n",
|
||||||
(void) chdir(path);
|
__func__, path);
|
||||||
#endif
|
}
|
||||||
mbedtls_free(path);
|
mbedtls_free(path);
|
||||||
}
|
}
|
||||||
#endif /* MBEDTLS_HAVE_CHDIR */
|
#endif /* MBEDTLS_HAVE_CHDIR */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue