X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-fstatat.c;h=a128c876a99ce3d74058855b2488ae3a84eb197f;hb=1f28fa660e4ca110f073251a24ef3a94ad97ef69;hp=6160e16145cbdbd0a8020e05f93b47e57f577122;hpb=9c40f34443ba034ee7890ab10c369a903417765d;p=gnulib.git diff --git a/tests/test-fstatat.c b/tests/test-fstatat.c index 6160e1614..a128c876a 100644 --- a/tests/test-fstatat.c +++ b/tests/test-fstatat.c @@ -1,5 +1,5 @@ /* Tests of fstatat. - Copyright (C) 2009 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 @@ -31,8 +31,9 @@ SIGNATURE_CHECK (fstatat, int, (int, char const *, struct stat *, int)); #include #include "openat.h" -#include "pathmax.h" +#include "progname.h" #include "same-inode.h" +#include "ignore-value.h" #include "macros.h" #define BASE "test-fstatat.t" @@ -57,12 +58,30 @@ do_lstat (char const *name, struct stat *st) } int -main (void) +main (int argc _GL_UNUSED, char *argv[]) { int result; + set_program_name (argv[0]); + /* Remove any leftovers from a previous partial run. */ - system ("rm -rf " BASE "*"); + ignore_value (system ("rm -rf " BASE "*")); + + /* Test behaviour for invalid file descriptors. */ + { + struct stat statbuf; + + errno = 0; + ASSERT (fstatat (-1, "foo", &statbuf, 0) == -1); + ASSERT (errno == EBADF); + } + { + struct stat statbuf; + + errno = 0; + ASSERT (fstatat (99, "foo", &statbuf, 0) == -1); + ASSERT (errno == EBADF); + } result = test_stat_func (do_stat, false); ASSERT (test_lstat_func (do_lstat, false) == result);