X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-mkdirat.c;h=f538504e97252f0dc04bce9f6a03748b607dcc8a;hb=33f823397dbb0edb57503f2f6dad2362456bc6a9;hp=9aee33a7d023400f45b6dfaab91942d6fb721d65;hpb=b2e2010c7c902235b5efb5bd3c6529f61b093aa4;p=gnulib.git diff --git a/tests/test-mkdirat.c b/tests/test-mkdirat.c index 9aee33a7d..f538504e9 100644 --- a/tests/test-mkdirat.c +++ b/tests/test-mkdirat.c @@ -1,5 +1,5 @@ /* Tests of mkdirat. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2009-2012 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,6 +30,8 @@ SIGNATURE_CHECK (mkdirat, int, (int, char const *, mode_t)); #include #include +#include "progname.h" +#include "ignore-value.h" #include "macros.h" #define BASE "test-mkdirat.t" @@ -46,12 +48,26 @@ do_mkdir (char const *name, mode_t mode) } int -main (void) +main (int argc _GL_UNUSED, char *argv[]) { int result; + set_program_name (argv[0]); + /* Clean up any trash from prior testsuite runs. */ - system ("rm -rf " BASE "*"); + ignore_value (system ("rm -rf " BASE "*")); + + /* Test behaviour for invalid file descriptors. */ + { + errno = 0; + ASSERT (mkdirat (-1, "foo", 0700) == -1); + ASSERT (errno == EBADF); + } + { + errno = 0; + ASSERT (mkdirat (99, "foo", 0700) == -1); + ASSERT (errno == EBADF); + } /* Test basic mkdir functionality. */ result = test_mkdir (do_mkdir, false);