Skip to content

Commit

Permalink
Print a notice if chdir fails
Browse files Browse the repository at this point in the history
Fixes -Wunused-result warning.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
  • Loading branch information
gilles-peskine-arm committed Oct 25, 2023
1 parent 9cc1255 commit 994efa2
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions tests/suites/host_test.function
Original file line number Diff line number Diff line change
Expand Up @@ -433,8 +433,7 @@ static void write_outcome_result(FILE *outcome_file,
}

#if defined(__unix__) || \
(defined(__APPLE__) && defined(__MACH__)) || \
defined(_WIN32)
(defined(__APPLE__) && defined(__MACH__))
#define MBEDTLS_HAVE_CHDIR
#endif

Expand All @@ -456,11 +455,11 @@ static void try_chdir(const char *argv0)
}
memcpy(path, argv0, path_size - 1);
path[path_size - 1] = 0;
#if defined(_WIN32)
(void) _chdir(path);
#else
(void) chdir(path);
#endif
int ret = chdir(path);
if (ret != 0) {
mbedtls_fprintf(stderr, "%s: note: chdir(\"%s\") failed.\n",
__func__, path);
}
mbedtls_free(path);
}
#endif /* MBEDTLS_HAVE_CHDIR */
Expand Down

0 comments on commit 994efa2

Please sign in to comment.