X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-fstatat.c;h=a128c876a99ce3d74058855b2488ae3a84eb197f;hb=1f28fa660e4ca110f073251a24ef3a94ad97ef69;hp=dda0cd224105861afe5e9092c19ef539d64482ca;hpb=d9a273b271b226547775c9b9798d7afd96ef5410;p=gnulib.git diff --git a/tests/test-fstatat.c b/tests/test-fstatat.c index dda0cd224..a128c876a 100644 --- a/tests/test-fstatat.c +++ b/tests/test-fstatat.c @@ -1,5 +1,5 @@ /* Tests of fstatat. - Copyright (C) 2009-2011 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,7 +31,6 @@ 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" @@ -68,6 +67,22 @@ main (int argc _GL_UNUSED, char *argv[]) /* Remove any leftovers from a previous partial run. */ 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); dfd = open (".", O_RDONLY);