aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/fish_tests.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2015-07-26 02:15:59 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2015-07-26 02:15:59 -0700
commit78af59f40cf176c12680ba21ee42575960497951 (patch)
tree49bb5aedde78d35205b44dd59d089cb3eb030da7 /src/fish_tests.cpp
parentc59f5e9f0178639a06ae5aeb0ca841ce003328fb (diff)
Handle getcwd failures to satisfy the linter
Diffstat (limited to 'src/fish_tests.cpp')
-rw-r--r--src/fish_tests.cpp12
1 files changed, 10 insertions, 2 deletions
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");