Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-4]: src/regress/sys/kern/getcwd Pull up revisions 1.4-1.5 (requ...
details: https://anonhg.NetBSD.org/src/rev/636038284a9d
branches: netbsd-1-4
changeset: 469731:636038284a9d
user: he <he%NetBSD.org@localhost>
date: Sun Nov 21 15:19:06 1999 +0000
description:
Pull up revisions 1.4-1.5 (requested by scw and sommerfeld):
Compensate for fix to PR#7761 (kernel now clips overly large
length), and add another test.
diffstat:
regress/sys/kern/getcwd/getcwd.c | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 deletions(-)
diffs (40 lines):
diff -r 9a5ffcf51e88 -r 636038284a9d regress/sys/kern/getcwd/getcwd.c
--- a/regress/sys/kern/getcwd/getcwd.c Sun Nov 21 15:15:45 1999 +0000
+++ b/regress/sys/kern/getcwd/getcwd.c Sun Nov 21 15:19:06 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: getcwd.c,v 1.3 1999/03/26 22:23:58 sommerfe Exp $ */
+/* $NetBSD: getcwd.c,v 1.3.2.1 1999/11/21 15:19:06 he Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -260,6 +260,19 @@
chdir ("/");
rmdir ("/tmp/permdir/subdir");
rmdir ("/tmp/permdir");
+
+ mkdir ("/tmp/permdir", 0755);
+ mkdir ("/tmp/permdir/subdir", 0711);
+ chdir ("/tmp/permdir/subdir");
+
+ seteuid(altid);
+
+ CHECK("/tmp/permdir/subdir", __getcwd(kbuf, sizeof(kbuf)), 20, 0);
+
+ seteuid(0);
+ chdir ("/");
+ rmdir ("/tmp/permdir/subdir");
+ rmdir ("/tmp/permdir");
}
void
@@ -335,8 +348,8 @@
CHECK("/", __getcwd(0, 0), -1, ERANGE);
CHECK("/", __getcwd(0, -1), -1, ERANGE);
CHECK("/", __getcwd(kbuf, 0xdeadbeef), -1, ERANGE); /* large negative */
- CHECK("/", __getcwd(kbuf, 0x7000beef), -1, ERANGE); /* large positive */
- CHECK("/", __getcwd(kbuf, 0x10000), -1, ERANGE); /* outside address space */
+ CHECK("/", __getcwd(kbuf, 0x7000beef), 2, 0); /* large positive, rounds down */
+ CHECK("/", __getcwd(kbuf, 0x10000), 2, 0); /* slightly less large positive, rounds down */
CHECK("/", __getcwd(kbuf+0x100000, sizeof(kbuf)), -1, EFAULT); /* outside address space */
CHECK("/", __getcwd(0, 30), -1, EFAULT);
CHECK("/", __getcwd((void*)0xdeadbeef, 30), -1, EFAULT);
Home |
Main Index |
Thread Index |
Old Index