From 78af59f40cf176c12680ba21ee42575960497951 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sun, 26 Jul 2015 02:15:59 -0700 Subject: Handle getcwd failures to satisfy the linter --- src/fish_tests.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/fish_tests.cpp') diff --git a/src/fish_tests.cpp b/src/fish_tests.cpp index d2b1e23e..8d44cce1 100644 --- a/src/fish_tests.cpp +++ b/src/fish_tests.cpp @@ -2037,7 +2037,11 @@ static void test_complete(void) /* File completions */ char saved_wd[PATH_MAX + 1] = {}; - (void)getcwd(saved_wd, sizeof saved_wd); + if (!getcwd(saved_wd, sizeof saved_wd)) + { + perror("getcwd"); + exit(-1); + } if (system("mkdir -p '/tmp/complete_test/'")) err(L"mkdir failed"); if (system("touch '/tmp/complete_test/testfile'")) err(L"touch failed"); if (chdir("/tmp/complete_test/")) err(L"chdir failed"); @@ -3891,7 +3895,11 @@ int main(int argc, char **argv) while (access("./tests/test.fish", F_OK) != 0) { char wd[PATH_MAX + 1] = {}; - (void)getcwd(wd, sizeof wd); + if (!getcwd(wd, sizeof wd)) + { + perror("getcwd"); + exit(-1); + } if (! strcmp(wd, "/")) { fprintf(stderr, "Unable to find 'tests' directory, which should contain file test.fish\n"); -- cgit v1.2.3