diff options
author | Jakub Jelinek <jakub@redhat.com> | 2006-04-24 20:31:50 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2006-04-24 20:31:50 +0000 |
commit | 1100b0e29213d536814d675cb3e1faff447db322 (patch) | |
tree | c6eb5ed6b41bccaaa7a9b263cac188a143a89e74 /debug/tst-chk1.c | |
parent | 48f59b8e1a60fa1e9f20bfd322214cec1be3a635 (diff) |
Updated to fedora-glibc-20060424T2027
Diffstat (limited to 'debug/tst-chk1.c')
-rw-r--r-- | debug/tst-chk1.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/debug/tst-chk1.c b/debug/tst-chk1.c index a47d1466ec..c450744af5 100644 --- a/debug/tst-chk1.c +++ b/debug/tst-chk1.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2004, 2005 Free Software Foundation, Inc. +/* Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek <jakub@redhat.com>, 2004. @@ -947,6 +947,34 @@ do_test (void) CHK_FAIL_END #endif + int tmpfd = open ("/tmp", O_RDONLY | O_DIRECTORY); + if (tmpfd < 0) + FAIL (); + + if (readlinkat (tmpfd, fname + sizeof ("/tmp/") - 1, readlinkbuf, 4) != 3 + || memcmp (readlinkbuf, "bar", 3) != 0) + FAIL (); + if (readlinkat (tmpfd, fname + sizeof ("/tmp/") - 1, readlinkbuf + 1, + l0 + 3) != 3 + || memcmp (readlinkbuf, "bbar", 4) != 0) + FAIL (); + +#if __USE_FORTIFY_LEVEL >= 1 + CHK_FAIL_START + if (readlinkat (tmpfd, fname + sizeof ("/tmp/") - 1, readlinkbuf + 2, + l0 + 3) != 3) + FAIL (); + CHK_FAIL_END + + CHK_FAIL_START + if (readlinkat (tmpfd, fname + sizeof ("/tmp/") - 1, readlinkbuf + 3, + 4) != 3) + FAIL (); + CHK_FAIL_END +#endif + + close (tmpfd); + char *cwd1 = getcwd (NULL, 0); if (cwd1 == NULL) FAIL (); |