Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/syscall Check for getuid(2) == 0.



details:   https://anonhg.NetBSD.org/src/rev/0f00b50b5481
branches:  trunk
changeset: 763772:0f00b50b5481
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Mon Apr 04 01:49:45 2011 +0000

description:
Check for getuid(2) == 0.

diffstat:

 tests/syscall/t_access.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r 4e0479531cf0 -r 0f00b50b5481 tests/syscall/t_access.c
--- a/tests/syscall/t_access.c  Sun Apr 03 23:44:46 2011 +0000
+++ b/tests/syscall/t_access.c  Mon Apr 04 01:49:45 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_access.c,v 1.1 2011/04/03 16:12:46 jruoho Exp $ */
+/* $NetBSD: t_access.c,v 1.2 2011/04/04 01:49:45 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_access.c,v 1.1 2011/04/03 16:12:46 jruoho Exp $");
+__RCSID("$NetBSD: t_access.c,v 1.2 2011/04/04 01:49:45 jruoho Exp $");
 
 #include <errno.h>
 #include <fcntl.h>
@@ -55,6 +55,9 @@
        size_t i;
        int fd;
 
+       if (getuid() == 0)
+               return;
+
        fd = open(path, O_RDONLY | O_CREAT);
 
        if (fd < 0)



Home | Main Index | Thread Index | Old Index