add Makefile.inc everywhere so that we can set WARNS=4 by default. Amazing

how many bugs this found :-)
This commit is contained in:
christos 2010-11-03 16:10:19 +00:00
parent d3d3da9ee3
commit 0f10aa9dce
48 changed files with 189 additions and 161 deletions

2
tests/Makefile.inc Normal file
View File

@ -0,0 +1,2 @@
# $NetBSD: Makefile.inc,v 1.1 2010/11/03 16:10:19 christos Exp $
WARNS ?= 4

View File

@ -0,0 +1 @@
.include "../Makefile.inc"

View File

@ -1,7 +1,8 @@
# $NetBSD: Makefile.inc,v 1.3 2010/07/13 21:13:21 jmmv Exp $
# $NetBSD: Makefile.inc,v 1.4 2010/11/03 16:10:19 christos Exp $
.include <bsd.own.mk>
# Not yet
# .include "../Makefile.inc"
TESTSDIR= ${TESTSBASE}/crypto/libcrypto
ATFFILE= no

1
tests/dev/Makefile.inc Normal file
View File

@ -0,0 +1 @@
.include "../Makefile.inc"

1
tests/fs/Makefile.inc Normal file
View File

@ -0,0 +1 @@
.include "../Makefile.inc"

View File

@ -0,0 +1 @@
.include "../Makefile.inc"

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_bitstring.c,v 1.1 2010/07/17 19:26:27 jmmv Exp $ */
/* $NetBSD: t_bitstring.c,v 1.2 2010/11/03 16:10:20 christos Exp $ */
/*-
* Copyright (c) 1993, 2008, 2010 The NetBSD Foundation, Inc.
@ -63,9 +63,8 @@ printbits(FILE *file, bitstr_t *b, int n)
static void
calculate_data(FILE *file, const int test_length)
{
int b, i;
int i;
bitstr_t *bs;
bitstr_t bit_decl(bss, 37); /* Mostly a random number. */
assert(test_length >= 4);
@ -75,7 +74,7 @@ calculate_data(FILE *file, const int test_length)
(void) fprintf(file, " i _bit_byte(i) _bit_mask(i) bitstr_size(i)\n");
for (i=0; i < test_length; i++) {
(void) fprintf(file, "%3d%15d%15d%15d\n",
(void) fprintf(file, "%3d%15u%15u%15zu\n",
i, _bit_byte(i), _bit_mask(i), bitstr_size(i));
}
@ -205,7 +204,7 @@ calculate_data(FILE *file, const int test_length)
(void) free(bs);
}
void
static void
one_check(const atf_tc_t *tc, const int test_length)
{
FILE *out;

View File

@ -0,0 +1 @@
.include "../Makefile.inc"

View File

@ -0,0 +1 @@
.include "../Makefile.inc"

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_sig.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $ */
/* $NetBSD: t_sig.c,v 1.2 2010/11/03 16:10:20 christos Exp $ */
/*-
* Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@ -32,7 +32,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
__RCSID("$NetBSD: t_sig.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $");
__RCSID("$NetBSD: t_sig.c,v 1.2 2010/11/03 16:10:20 christos Exp $");
#include <sys/event.h>
#include <sys/ioctl.h>
@ -111,8 +111,8 @@ ATF_TC_BODY(sig, tc)
RL(gettimeofday(&now, NULL));
timersub(&now, &then, &diff);
(void)printf("sig: kevent returned %d in %ld.%06ld\n",
n, diff.tv_sec, diff.tv_usec);
(void)printf("sig: kevent returned %d in %lld.%06ld\n",
n, (long long)diff.tv_sec, (long)diff.tv_usec);
if (n == 0)
continue;

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_extent.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $ */
/* $NetBSD: t_extent.c,v 1.2 2010/11/03 16:10:20 christos Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -29,7 +29,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
__RCSID("$NetBSD: t_extent.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $");
__RCSID("$NetBSD: t_extent.c,v 1.2 2010/11/03 16:10:20 christos Exp $");
#include <sys/types.h>
#include <sys/queue.h>
@ -82,7 +82,7 @@ h_alloc_subregion(u_long substart, u_long subend, u_long size,
static void
h_require(const char *name, u_long start,
u_long end, u_long flags, const char *exp)
u_long end, long flags, const char *exp)
{
char buf[4096];
struct extent_region *rp;

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_filedesc.c,v 1.3 2010/08/04 14:28:28 pooka Exp $ */
/* $NetBSD: t_filedesc.c,v 1.4 2010/11/03 16:10:20 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: t_filedesc.c,v 1.3 2010/08/04 14:28:28 pooka Exp $");
__RCSID("$NetBSD: t_filedesc.c,v 1.4 2010/11/03 16:10:20 christos Exp $");
#include <sys/types.h>
@ -35,6 +35,7 @@ __RCSID("$NetBSD: t_filedesc.c,v 1.3 2010/08/04 14:28:28 pooka Exp $");
#include <atf-c.h>
#include <fcntl.h>
#include <stdlib.h>
#include <pthread.h>
#include <rump/rump.h>
#include <rump/rump_syscalls.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_pr.c,v 1.2 2010/07/03 08:18:30 jmmv Exp $ */
/* $NetBSD: t_pr.c,v 1.3 2010/11/03 16:10:20 christos Exp $ */
#include <sys/types.h>
#include <sys/ioctl.h>
@ -24,8 +24,7 @@ ATF_TC_BODY(ptyioctl, tc)
rump_init();
fd = rump_sys_open("/dev/ptyp1", O_RDWR);
if (fd == -1)
err(1, "open");
ATF_CHECK(fd != -1);
/* boom, dies with null deref under ptcwakeup() */
atf_tc_expect_signal(-1, "PR kern/40688");

1
tests/lib/Makefile.inc Normal file
View File

@ -0,0 +1 @@
.include "../Makefile.inc"

View File

@ -0,0 +1 @@
.include "../Makefile.inc"

View File

@ -1,11 +1,11 @@
# $NetBSD: Makefile,v 1.6 2010/09/09 22:25:38 christos Exp $
# $NetBSD: Makefile,v 1.7 2010/11/03 16:10:21 christos Exp $
.include <bsd.own.mk>
TESTS_SUBDIRS+= gen hash stdlib
TESTS_SUBDIRS+= gen hash stdlib stdio
# Disabled for now, only test in there is very expensive
#SUBDIR+= string
SUBDIR+= string
TESTSDIR= ${TESTSBASE}/lib/libc

View File

@ -0,0 +1 @@
.include "../Makefile.inc"

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_glob_star.c,v 1.5 2010/10/13 11:19:28 pooka Exp $ */
/* $NetBSD: t_glob_star.c,v 1.6 2010/11/03 16:10:21 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
* All rights reserved.
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: t_glob_star.c,v 1.5 2010/10/13 11:19:28 pooka Exp $");
__RCSID("$NetBSD: t_glob_star.c,v 1.6 2010/11/03 16:10:21 christos Exp $");
#include <atf-c.h>
@ -127,12 +127,12 @@ static struct dirent *
gl_readdir(void *v)
{
static struct dirent dir;
struct gl_dir *d = v;
if (d->pos < d->len) {
const struct gl_file *f = &d->dir[d->pos++];
struct gl_dir *dd = v;
if (dd->pos < dd->len) {
const struct gl_file *f = &dd->dir[dd->pos++];
strcpy(dir.d_name, f->name);
dir.d_namlen = strlen(f->name);
dir.d_ino = d->pos;
dir.d_ino = dd->pos;
dir.d_type = f->dir ? DT_DIR : DT_REG;
DPRINTF(("readdir %s %d\n", dir.d_name, dir.d_type));
dir.d_reclen = _DIRENT_RECLEN(&dir, dir.d_namlen);
@ -162,9 +162,9 @@ gl_lstat(const char *name , __gl_stat_t *st)
static void
gl_closedir(void *v)
{
struct gl_dir *d = v;
d->pos = 0;
DPRINTF(("closedir %p\n", d));
struct gl_dir *dd = v;
dd->pos = 0;
DPRINTF(("closedir %p\n", dd));
}
static void

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_sha2.c,v 1.1 2010/01/24 21:12:17 joerg Exp $ */
/* $NetBSD: t_sha2.c,v 1.2 2010/11/03 16:10:22 christos Exp $ */
/*-
* Copyright (c) 20010 The NetBSD Foundation, Inc.
* All rights reserved.
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: t_sha2.c,v 1.1 2010/01/24 21:12:17 joerg Exp $");
__RCSID("$NetBSD: t_sha2.c,v 1.2 2010/11/03 16:10:22 christos Exp $");
#include <atf-c.h>
#include <sys/types.h>
@ -144,7 +144,7 @@ static const struct testvector test512[] = {
{ "abcdefghijklmnopqrstuvwq", "404eb5652173323320cac6bf8d9714aef0747693a8ab4570700c6262268d367f30e31c44fa66860568ff058fe39c9aa8dac76bc78566c691a884cb9052c4aa0a" },
};
void
static void
digest2string(const uint8_t *digest, char *string, size_t len)
{
while (len--) {
@ -171,8 +171,8 @@ ATF_TC_BODY(t_sha256, tc)
{
size_t i, j, len;
SHA256_CTX ctx;
char buf[256];
char digest[8 + SHA256_DIGEST_LENGTH];
unsigned char buf[256];
unsigned char digest[8 + SHA256_DIGEST_LENGTH];
char output[SHA256_DIGEST_STRING_LENGTH];
for (i = 0; i < sizeof(test256) / sizeof(test256[0]); ++i) {
@ -198,8 +198,8 @@ ATF_TC_BODY(t_sha384, tc)
{
size_t i, j, len;
SHA384_CTX ctx;
char buf[384];
char digest[8 + SHA384_DIGEST_LENGTH];
unsigned char buf[384];
unsigned char digest[8 + SHA384_DIGEST_LENGTH];
char output[SHA384_DIGEST_STRING_LENGTH];
for (i = 0; i < sizeof(test384) / sizeof(test384[0]); ++i) {
@ -225,8 +225,8 @@ ATF_TC_BODY(t_sha512, tc)
{
size_t i, j, len;
SHA512_CTX ctx;
char buf[512];
char digest[8 + SHA512_DIGEST_LENGTH];
unsigned char buf[512];
unsigned char digest[8 + SHA512_DIGEST_LENGTH];
char output[SHA512_DIGEST_STRING_LENGTH];
for (i = 0; i < sizeof(test512) / sizeof(test512[0]); ++i) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_fmemopen.c,v 1.1 2010/09/24 09:21:53 tnozaki Exp $ */
/* $NetBSD: t_fmemopen.c,v 1.2 2010/11/03 16:10:22 christos Exp $ */
/*-
* Copyright (c)2010 Takehiko NOZAKI,
@ -68,7 +68,7 @@ const char *mode_a[] = { "a", "ab", "a+", "ab+", "a+b", NULL };
struct testcase {
const char *s;
size_t n;
off_t n;
} testcases[] = {
#define TESTSTR(s) { s, sizeof(s)-1 }
TESTSTR("\0he quick brown fox jumps over the lazy dog"),
@ -751,9 +751,9 @@ ATF_TC_BODY(test15, tc)
{
struct testcase *t;
const char **p;
char buf0[BUFSIZ], buf1[BUFSIZ];
char buf0[BUFSIZ];
FILE *fp;
size_t i;
int i;
for (t = &testcases[0]; t->s != NULL; ++t) {
for (p = &mode_rw1[0]; *p != NULL; ++p) {
@ -764,7 +764,7 @@ ATF_TC_BODY(test15, tc)
/*
* test fmemopen_read + fgetc(3)
*/
for (i = (size_t)0; i < t->n; ++i) {
for (i = 0; i < t->n; ++i) {
ATF_CHECK(ftello(fp) == (off_t)i);
ATF_CHECK(fgetc(fp) == buf0[i]);
ATF_CHECK(feof(fp) == 0);
@ -801,7 +801,7 @@ ATF_TC_BODY(test16, tc)
* test fmemopen_read + fread(4)
*/
ATF_CHECK(ftello(fp) == (off_t)0);
ATF_CHECK(fread(&buf1[0], 1, sizeof(buf1), fp) == t->n);
ATF_CHECK(fread(&buf1[0], 1, sizeof(buf1), fp) == (size_t)t->n);
ATF_CHECK(feof(fp) != 0);
ATF_CHECK(memcmp(&buf0[0], &buf1[0], t->n) == 0);
ATF_CHECK((unsigned char)buf1[t->n] == 0x1);
@ -821,7 +821,8 @@ ATF_TC_HEAD(test17, tc)
ATF_TC_BODY(test17, tc)
{
struct testcase *t;
size_t len, i;
size_t len;
int i;
const char **p;
char buf[BUFSIZ];
FILE *fp;
@ -849,7 +850,7 @@ ATF_TC_BODY(test17, tc)
ATF_CHECK(feof(fp) != 0);
ATF_CHECK(ftello(fp) == (off_t)t->n);
rewind(fp);
for (i = (size_t)0; i < t->n; ++i) {
for (i = 0; i < t->n; ++i) {
ATF_CHECK(ftello(fp) == (off_t)i);
ATF_CHECK(fgetc(fp) == buf[i]);
ATF_CHECK(feof(fp) == 0);
@ -874,7 +875,7 @@ ATF_TC_HEAD(test18, tc)
ATF_TC_BODY(test18, tc)
{
struct testcase *t;
size_t len, i;
size_t len;
const char **p;
char buf0[BUFSIZ], buf1[BUFSIZ];
FILE *fp;
@ -903,7 +904,7 @@ ATF_TC_BODY(test18, tc)
buf1[t->n] = 0x1;
ATF_CHECK(ftello(fp) == (off_t)0);
ATF_CHECK(fread(&buf1[0], 1, sizeof(buf1), fp)
== t->n);
== (size_t)t->n);
ATF_CHECK(feof(fp) != 0);
ATF_CHECK(!memcmp(&buf0[0], &buf1[0], t->n));
ATF_CHECK((unsigned char)buf1[t->n] == 0x1);
@ -936,7 +937,8 @@ ATF_TC_HEAD(test19, tc)
ATF_TC_BODY(test19, tc)
{
struct testcase *t;
size_t len, i;
size_t len;
int i;
const char **p;
char buf[BUFSIZ];
FILE *fp;
@ -953,7 +955,7 @@ ATF_TC_BODY(test19, tc)
/*
* test fmemopen_write + fputc(3)
*/
for (i = (size_t)0; i < t->n; ++i) {
for (i = 0; i < t->n; ++i) {
ATF_CHECK(ftello(fp) == (off_t)i);
ATF_CHECK(fputc(t->s[i], fp) == t->s[i]);
ATF_CHECK(buf[i] == t->s[i]);
@ -995,7 +997,7 @@ ATF_TC_HEAD(test20, tc)
ATF_TC_BODY(test20, tc)
{
struct testcase *t;
size_t len, i;
size_t len;
const char **p;
char buf[BUFSIZ];
FILE *fp;
@ -1009,7 +1011,7 @@ ATF_TC_BODY(test20, tc)
fp = fmemopen(&buf[0], t->n + 1, *p);
ATF_CHECK(fp != NULL);
setbuf(fp, NULL);
ATF_CHECK(fwrite(t->s, 1, t->n, fp) == t->n);
ATF_CHECK(fwrite(t->s, 1, t->n, fp) == (size_t)t->n);
/*
* test fmemopen_write + fwrite(3)
*/
@ -1048,7 +1050,7 @@ ATF_TC_HEAD(test21, tc)
ATF_TC_BODY(test21, tc)
{
struct testcase *t;
size_t len, i;
int len, i;
const char **p;
char buf[BUFSIZ];
FILE *fp;
@ -1104,7 +1106,7 @@ ATF_TC_HEAD(test22, tc)
ATF_TC_BODY(test22, tc)
{
struct testcase *t0, *t1;
size_t len0, len1, i, nleft;
size_t len0, len1, nleft;
const char **p;
char buf[BUFSIZ];
FILE *fp;

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_basic.c,v 1.1 2010/07/16 13:56:31 jmmv Exp $ */
/* $NetBSD: t_basic.c,v 1.2 2010/11/03 16:10:22 christos Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -34,10 +34,11 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
__RCSID("$NetBSD: t_basic.c,v 1.1 2010/07/16 13:56:31 jmmv Exp $");
__RCSID("$NetBSD: t_basic.c,v 1.2 2010/11/03 16:10:22 christos Exp $");
#include <prop/proplib.h>
#include <stdlib.h>
#include <string.h>
#include <prop/proplib.h>
#include <atf-c.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: h_resolv.c,v 1.1 2010/07/16 15:42:53 jmmv Exp $ */
/* $NetBSD: h_resolv.c,v 1.2 2010/11/03 16:10:22 christos Exp $ */
/*-
* Copyright (c) 2004, 2008 The NetBSD Foundation, Inc.
@ -32,7 +32,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
__RCSID("$NetBSD: h_resolv.c,v 1.1 2010/07/16 15:42:53 jmmv Exp $");
__RCSID("$NetBSD: h_resolv.c,v 1.2 2010/11/03 16:10:22 christos Exp $");
#include <pthread.h>
#include <stdio.h>
@ -193,7 +193,7 @@ main(int argc, char *argv[])
sleep(1);
}
c = 0;
for (i = 0; i < hosts->sl_cur; i++) {
for (i = 0; i < (int)hosts->sl_cur; i++) {
if (ask[i] != got[i] && got[i] != 0) {
warnx("Error: host %s ask %d got %d\n",
hosts->sl_str[i], ask[i], got[i]);

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_barrier.c,v 1.1 2010/07/16 15:42:53 jmmv Exp $ */
/* $NetBSD: t_barrier.c,v 1.2 2010/11/03 16:10:22 christos Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -29,7 +29,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
__RCSID("$NetBSD: t_barrier.c,v 1.1 2010/07/16 15:42:53 jmmv Exp $");
__RCSID("$NetBSD: t_barrier.c,v 1.2 2010/11/03 16:10:22 christos Exp $");
#include <pthread.h>
#include <stdio.h>
@ -50,15 +50,15 @@ static void *
threadfunc(void *arg)
{
int which = (int)(long)arg;
int ret;
int rv;
printf("thread %d entering barrier\n", which);
ret = pthread_barrier_wait(&barrier);
printf("thread %d leaving barrier -> %d\n", which, ret);
rv = pthread_barrier_wait(&barrier);
printf("thread %d leaving barrier -> %d\n", which, rv);
PTHREAD_REQUIRE(pthread_mutex_lock(&mutex));
after_barrier_count++;
if (ret == PTHREAD_BARRIER_SERIAL_THREAD)
if (rv == PTHREAD_BARRIER_SERIAL_THREAD)
serial_count++;
PTHREAD_REQUIRE(pthread_mutex_unlock(&mutex));

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_cond.c,v 1.1 2010/07/16 15:42:53 jmmv Exp $ */
/* $NetBSD: t_cond.c,v 1.2 2010/11/03 16:10:22 christos Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -29,7 +29,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
__RCSID("$NetBSD: t_cond.c,v 1.1 2010/07/16 15:42:53 jmmv Exp $");
__RCSID("$NetBSD: t_cond.c,v 1.2 2010/11/03 16:10:22 christos Exp $");
#include <sys/time.h>
@ -51,15 +51,15 @@ static int count, share, toggle, total;
static void *
signal_delay_wait_threadfunc(void *arg)
{
int *share = (int *) arg;
int *shared = (int *) arg;
printf("2: Second thread.\n");
printf("2: Locking mutex\n");
PTHREAD_REQUIRE(pthread_mutex_lock(&mutex));
printf("2: Got mutex.\n");
printf("Shared value: %d. Changing to 0.\n", *share);
*share = 0;
printf("Shared value: %d. Changing to 0.\n", *shared);
*shared = 0;
PTHREAD_REQUIRE(pthread_mutex_unlock(&mutex));
PTHREAD_REQUIRE(pthread_cond_signal(&cond));
@ -112,15 +112,15 @@ ATF_TC_BODY(signal_delay_wait, tc)
static void *
signal_before_unlock_threadfunc(void *arg)
{
int *share = (int *) arg;
int *shared = (int *) arg;
printf("2: Second thread.\n");
printf("2: Locking mutex\n");
PTHREAD_REQUIRE(pthread_mutex_lock(&mutex));
printf("2: Got mutex.\n");
printf("Shared value: %d. Changing to 0.\n", *share);
*share = 0;
printf("Shared value: %d. Changing to 0.\n", *shared);
*shared = 0;
/* Signal first, then unlock, for a different test than #1. */
PTHREAD_REQUIRE(pthread_cond_signal(&cond));
@ -175,15 +175,15 @@ ATF_TC_BODY(signal_before_unlock, tc)
static void *
signal_before_unlock_static_init_threadfunc(void *arg)
{
int *share = (int *) arg;
int *shared = (int *) arg;
printf("2: Second thread.\n");
printf("2: Locking mutex\n");
PTHREAD_REQUIRE(pthread_mutex_lock(&static_mutex));
printf("2: Got mutex.\n");
printf("Shared value: %d. Changing to 0.\n", *share);
*share = 0;
printf("Shared value: %d. Changing to 0.\n", *shared);
*shared = 0;
/* Signal first, then unlock, for a different test than #1. */
PTHREAD_REQUIRE(pthread_cond_signal(&static_cond));

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_preempt.c,v 1.1 2010/07/16 15:42:53 jmmv Exp $ */
/* $NetBSD: t_preempt.c,v 1.2 2010/11/03 16:10:22 christos Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -29,7 +29,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
__RCSID("$NetBSD: t_preempt.c,v 1.1 2010/07/16 15:42:53 jmmv Exp $");
__RCSID("$NetBSD: t_preempt.c,v 1.2 2010/11/03 16:10:22 christos Exp $");
#include <errno.h>
#include <fcntl.h>
@ -75,7 +75,8 @@ ATF_TC_HEAD(preempt1, tc)
}
ATF_TC_BODY(preempt1, tc)
{
int ret, i;
int i;
ssize_t rv;
pthread_t new;
void *joinval;
@ -110,9 +111,9 @@ ATF_TC_BODY(preempt1, tc)
PTHREAD_REQUIRE(pthread_mutex_unlock(&mutex));
printf("1: After releasing the mutex.\n");
ret = read(fd, mem, HUGE_BUFFER);
rv = read(fd, mem, HUGE_BUFFER);
close(fd);
ATF_REQUIRE_EQ(ret, HUGE_BUFFER);
ATF_REQUIRE_EQ(rv, HUGE_BUFFER);
PTHREAD_REQUIRE(pthread_join(new, &joinval));

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_sem.c,v 1.4 2010/07/21 17:23:08 jmmv Exp $ */
/* $NetBSD: t_sem.c,v 1.5 2010/11/03 16:10:22 christos Exp $ */
/*
* Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
@ -86,7 +86,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008, 2010\
The NetBSD Foundation, inc. All rights reserved.");
__RCSID("$NetBSD: t_sem.c,v 1.4 2010/07/21 17:23:08 jmmv Exp $");
__RCSID("$NetBSD: t_sem.c,v 1.5 2010/11/03 16:10:22 christos Exp $");
#include <errno.h>
#include <fcntl.h>
@ -119,16 +119,16 @@ ATF_TC_HEAD(named, tc)
}
ATF_TC_BODY(named, tc)
{
sem_t *sem;
sem_t *semp;
ATF_REQUIRE_MSG(-1 != sysconf(_SC_SEMAPHORES), "%s", strerror(errno));
printf("Test begin\n");
(void) sem_unlink("/foo");
sem = sem_open("/foo", O_CREAT | O_EXCL, 0644, 0);
ATF_REQUIRE_MSG(sem != SEM_FAILED, "%s", strerror(errno));
SEM_REQUIRE(sem_close(sem));
semp = sem_open("/foo", O_CREAT | O_EXCL, 0644, 0);
ATF_REQUIRE_MSG(semp != SEM_FAILED, "%s", strerror(errno));
SEM_REQUIRE(sem_close(semp));
SEM_REQUIRE(sem_unlink("/foo"));
printf("Test end\n");
@ -144,10 +144,10 @@ static void *
entry(void * a_arg)
{
pthread_t self = pthread_self();
sem_t * sem = (sem_t *) a_arg;
sem_t *semp = (sem_t *) a_arg;
printf("Thread %p waiting for semaphore...\n", self);
sem_wait(sem);
sem_wait(semp);
printf("Thread %p got semaphore\n", self);
return NULL;

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_sigmask.c,v 1.1 2010/07/16 15:42:53 jmmv Exp $ */
/* $NetBSD: t_sigmask.c,v 1.2 2010/11/03 16:10:22 christos Exp $ */
/*
* Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
@ -29,7 +29,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008, 2010\
The NetBSD Foundation, inc. All rights reserved.");
__RCSID("$NetBSD: t_sigmask.c,v 1.1 2010/07/16 15:42:53 jmmv Exp $");
__RCSID("$NetBSD: t_sigmask.c,v 1.2 2010/11/03 16:10:22 christos Exp $");
/*
* Regression test for pthread_sigmask when SA upcalls aren't started yet.
@ -179,7 +179,7 @@ ATF_TC_BODY(respected_while_running, tc)
{
struct sigaction act;
pthread_t thread;
int ret;
int rv;
act.sa_sigaction = respected_while_running_handler1;
sigemptyset(&act.sa_mask);
@ -191,7 +191,7 @@ ATF_TC_BODY(respected_while_running, tc)
act.sa_sigaction = respected_while_running_handler2;
sigemptyset(&act.sa_mask);
act.sa_flags = SA_SIGINFO;
ret = sigaction(SIGUSR2, &act, NULL);
rv = sigaction(SIGUSR2, &act, NULL);
PTHREAD_REQUIRE(pthread_create(&thread, NULL,
respected_while_running_threadroutine, NULL));

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_status.c,v 1.1 2010/07/16 15:42:53 jmmv Exp $ */
/* $NetBSD: t_status.c,v 1.2 2010/11/03 16:10:22 christos Exp $ */
/*
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -29,7 +29,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2010\
The NetBSD Foundation, inc. All rights reserved.");
__RCSID("$NetBSD: t_status.c,v 1.1 2010/07/16 15:42:53 jmmv Exp $");
__RCSID("$NetBSD: t_status.c,v 1.2 2010/11/03 16:10:22 christos Exp $");
#include <sys/resource.h>
#include <sys/wait.h>
@ -53,7 +53,7 @@ threadfunc(void *arg)
return 0;
}
int
static int
child(const int seed)
{
pthread_t thr[NUM];
@ -86,7 +86,7 @@ child(const int seed)
return errors > 0 ? EXIT_FAILURE : EXIT_SUCCESS;
}
void
static void
do_test(const int seed)
{
pid_t pid = fork();

View File

@ -0,0 +1 @@
.include "../Makefile.inc"

View File

@ -0,0 +1 @@
.include "../Makefile.inc"

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_dlinfo.c,v 1.1 2009/09/24 21:33:45 pooka Exp $ */
/* $NetBSD: t_dlinfo.c,v 1.2 2010/11/03 16:10:23 christos Exp $ */
/*
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@ -89,4 +89,5 @@ ATF_TP_ADD_TCS(tp)
ATF_TP_ADD_TC(tp, rtld_dlinfo_linkmap_self);
ATF_TP_ADD_TC(tp, rtld_dlinfo_linkmap_inval);
ATF_TP_ADD_TC(tp, rtld_dlinfo_linkmap_dlopen);
return 0;
}

View File

@ -0,0 +1 @@
.include "../Makefile.inc"

View File

@ -1,4 +1,4 @@
/* $NetBSD: k_helper.c,v 1.4 2010/08/21 13:21:48 pgoyette Exp $ */
/* $NetBSD: k_helper.c,v 1.5 2010/11/03 16:10:23 christos Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
* All rights reserved.
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: k_helper.c,v 1.4 2010/08/21 13:21:48 pgoyette Exp $");
__KERNEL_RCSID(0, "$NetBSD: k_helper.c,v 1.5 2010/11/03 16:10:23 christos Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -45,7 +45,7 @@ MODULE(MODULE_CLASS_MISC, k_helper, NULL);
/* TODO: Change the integer variables below that represent booleans to
* bools, once sysctl(8) supports CTLTYPE_BOOL nodes. */
static struct sysctllog *clog;
static struct sysctllog *clogp;
static int present = 1;
static int prop_str_ok;
static char prop_str_val[128];
@ -163,7 +163,7 @@ k_helper_init(prop_dictionary_t props)
} else
prop_int_load = -2;
sysctl_k_helper_setup(&clog);
sysctl_k_helper_setup(&clogp);
return 0;
}
@ -173,7 +173,7 @@ int
k_helper_fini(void *arg)
{
sysctl_teardown(&clog);
sysctl_teardown(&clogp);
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: k_helper2.c,v 1.1 2010/08/21 13:21:48 pgoyette Exp $ */
/* $NetBSD: k_helper2.c,v 1.2 2010/11/03 16:10:23 christos Exp $ */
/*
* Copyright (c) 2010 The NetBSD Foundation, Inc.
* All rights reserved.
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: k_helper2.c,v 1.1 2010/08/21 13:21:48 pgoyette Exp $");
__KERNEL_RCSID(0, "$NetBSD: k_helper2.c,v 1.2 2010/11/03 16:10:23 christos Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -45,7 +45,7 @@ MODULE(MODULE_CLASS_MISC, k_helper2, NULL);
/* TODO: Change the integer variables below that represent booleans to
* bools, once sysctl(8) supports CTLTYPE_BOOL nodes. */
static struct sysctllog *clog;
static struct sysctllog *clogp;
static int present = 1;
#define K_HELPER2 0x23456781
@ -76,7 +76,7 @@ static
int
k_helper2_init(prop_dictionary_t props)
{
sysctl_k_helper2_setup(&clog);
sysctl_k_helper2_setup(&clogp);
return 0;
}
@ -86,7 +86,7 @@ int
k_helper2_fini(void *arg)
{
sysctl_teardown(&clog);
sysctl_teardown(&clogp);
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_builtin.c,v 1.1 2010/08/27 09:56:40 pooka Exp $ */
/* $NetBSD: t_builtin.c,v 1.2 2010/11/03 16:10:23 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc. All rights reserved.
@ -44,6 +44,8 @@
#define MYMP "/mnt"
#define HZFILE MYMP "/hz"
static char kernfs[] = "kernfs";
static bool
check_kernfs(void)
{
@ -77,7 +79,7 @@ ATF_TC_BODY(disable, tc)
RL(rump_sys_mount(MOUNT_KERNFS, MYMP, 0, NULL, 0));
ATF_REQUIRE(check_kernfs());
RL(rump_sys_unmount(MYMP, 0));
RL(rump_sys_modctl(MODCTL_UNLOAD, "kernfs"));
RL(rump_sys_modctl(MODCTL_UNLOAD, kernfs));
}
ATF_TC(noauto);
@ -93,7 +95,7 @@ ATF_TC_BODY(noauto, tc)
rump_init();
RL(rump_sys_mkdir(MYMP, 0777));
RL(rump_sys_modctl(MODCTL_UNLOAD, "kernfs"));
RL(rump_sys_modctl(MODCTL_UNLOAD, kernfs));
ATF_REQUIRE_ERRNO(ENODEV,
rump_sys_mount(MOUNT_KERNFS, MYMP, 0, NULL, 0) == -1);
@ -113,12 +115,12 @@ ATF_TC_BODY(forcereload, tc)
rump_init();
RL(rump_sys_mkdir(MYMP, 0777));
RL(rump_sys_modctl(MODCTL_UNLOAD, "kernfs"));
RL(rump_sys_modctl(MODCTL_UNLOAD, kernfs));
ATF_REQUIRE_ERRNO(ENODEV,
rump_sys_mount(MOUNT_KERNFS, MYMP, 0, NULL, 0) == -1);
memset(&mod, 0, sizeof(mod));
mod.ml_filename = "kernfs";
mod.ml_filename = kernfs;
mod.ml_flags = MODCTL_LOAD_FORCE;
RL(rump_sys_modctl(MODCTL_LOAD, &mod));
@ -139,21 +141,21 @@ ATF_TC_BODY(disabledstat, tc)
{
struct modstat ms[128];
struct iovec iov;
int i;
size_t i;
bool found = false;
rump_init();
RL(rump_sys_mkdir(MYMP, 0777));
RL(rump_sys_modctl(MODCTL_UNLOAD, "kernfs"));
RL(rump_sys_modctl(MODCTL_UNLOAD, kernfs));
iov.iov_base = ms;
iov.iov_len = sizeof(ms);
RL(rump_sys_modctl(MODCTL_STAT, &iov));
for (i = 0; i < __arraycount(ms); i++) {
if (strcmp(ms[i].ms_name, "kernfs") == 0) {
ATF_REQUIRE_EQ(ms[i].ms_refcnt, -1);
if (strcmp(ms[i].ms_name, kernfs) == 0) {
ATF_REQUIRE_EQ(ms[i].ms_refcnt, (u_int)-1);
found = 1;
break;
}
@ -176,7 +178,7 @@ ATF_TC_BODY(busydisable, tc)
RL(rump_sys_mount(MOUNT_KERNFS, MYMP, 0, NULL, 0));
ATF_REQUIRE(check_kernfs());
ATF_REQUIRE_ERRNO(EBUSY,
rump_sys_modctl(MODCTL_UNLOAD, "kernfs") == -1);
rump_sys_modctl(MODCTL_UNLOAD, kernfs) == -1);
}
ATF_TP_ADD_TCS(tp)

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_modctl.c,v 1.4 2010/08/21 13:21:48 pgoyette Exp $ */
/* $NetBSD: t_modctl.c,v 1.5 2010/11/03 16:10:23 christos Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
* All rights reserved.
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: t_modctl.c,v 1.4 2010/08/21 13:21:48 pgoyette Exp $");
__KERNEL_RCSID(0, "$NetBSD: t_modctl.c,v 1.5 2010/11/03 16:10:23 christos Exp $");
#include <sys/module.h>
#include <sys/sysctl.h>
@ -202,7 +202,8 @@ k_helper_is_present(enum presence_check how)
break;
default:
assert(false);
found = false;
assert(found);
}
return found;
@ -283,7 +284,7 @@ unload(const char *name, bool fatal)
* process only.
*/
static
int
void
unload_cleanup(const char *name)
{

1
tests/net/Makefile.inc Normal file
View File

@ -0,0 +1 @@
.include "../Makefile.inc"

View File

@ -8,6 +8,7 @@
#include <rump/rump.h>
#include <rump/rumpuser.h>
#include <rump/rump_syscalls.h>
ATF_TC(div_by_zero);
ATF_TC_HEAD(div_by_zero, tc)
@ -39,8 +40,7 @@ ATF_TC_BODY(div_by_zero, tc)
rump_init();
fd = rump_sys_open("/dev/bpf", O_RDWR);
if (fd == -1)
err(1, "open bpf");
ATF_CHECK(fd != -1);
ATF_REQUIRE_EQ_MSG(rump_sys_ioctl(fd, BIOCSETF, &bp), -1,
"bpf accepted program with division by zero");
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_basic.c,v 1.2 2010/08/11 13:10:03 pooka Exp $ */
/* $NetBSD: t_basic.c,v 1.3 2010/11/03 16:10:24 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -29,11 +29,12 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: t_basic.c,v 1.2 2010/08/11 13:10:03 pooka Exp $");
__RCSID("$NetBSD: t_basic.c,v 1.3 2010/11/03 16:10:24 christos Exp $");
#endif /* not lint */
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
@ -126,7 +127,7 @@ child(bool master)
else
cr.carpr_advskew = 200;
cr.carpr_advbase = 1;
strcpy(cr.carpr_key, "s3cret");
strcpy((char *)cr.carpr_key, "s3cret");
RL(rump_sys_ioctl(s, SIOCSVH, &ifr));
netcfg_rump_if(carpif, "10.1.1.100", "255.255.255.0");

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_forward.c,v 1.5 2010/07/26 14:10:31 pooka Exp $ */
/* $NetBSD: t_forward.c,v 1.6 2010/11/03 16:10:24 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -29,7 +29,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: t_forward.c,v 1.5 2010/07/26 14:10:31 pooka Exp $");
__RCSID("$NetBSD: t_forward.c,v 1.6 2010/11/03 16:10:24 christos Exp $");
#endif /* not lint */
#include <sys/types.h>
@ -67,7 +67,6 @@ __RCSID("$NetBSD: t_forward.c,v 1.5 2010/07/26 14:10:31 pooka Exp $");
static void
sendttl(void)
{
extern int rumpns_ip_defttl;
struct sockaddr_in sin;
char payload[1024];
char ifname[IFNAMSIZ];

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_ping.c,v 1.8 2010/08/26 17:24:14 pooka Exp $ */
/* $NetBSD: t_ping.c,v 1.9 2010/11/03 16:10:24 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -29,7 +29,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: t_ping.c,v 1.8 2010/08/26 17:24:14 pooka Exp $");
__RCSID("$NetBSD: t_ping.c,v 1.9 2010/11/03 16:10:24 christos Exp $");
#endif /* not lint */
#include <sys/types.h>
@ -129,7 +129,7 @@ in_cksum(void *data, size_t len)
}
static int
doping(const char *target, int loops, int pktsize)
doping(const char *target, int loops, size_t pktsize)
{
char sndbuf[IP_MAXPACKET - sizeof(struct ip)];
char recvbuf[IP_MAXPACKET];
@ -137,7 +137,7 @@ doping(const char *target, int loops, int pktsize)
struct icmp *icmp;
socklen_t slen;
ssize_t n;
int loop, i, succ;
int loop, succ;
int x, xnon, s;
RL(s = rump_sys_socket(PF_INET, SOCK_RAW, IPPROTO_ICMP));
@ -397,7 +397,7 @@ ATF_TC_BODY(ping_of_death, tc)
tot += (frag - sizeof(*ip))) {
frag = MIN(65538 - tot, sizeof(data));
ip->ip_off = tot >> 3;
assert(ip->ip_off << 3 == tot);
assert((size_t)ip->ip_off << 3 == tot);
ip->ip_len = frag;
if (frag == sizeof(data)) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_pr.c,v 1.2 2010/07/26 14:07:04 pooka Exp $ */
/* $NetBSD: t_pr.c,v 1.3 2010/11/03 16:10:25 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -29,7 +29,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: t_pr.c,v 1.2 2010/07/26 14:07:04 pooka Exp $");
__RCSID("$NetBSD: t_pr.c,v 1.3 2010/11/03 16:10:25 christos Exp $");
#endif /* not lint */
#include <sys/types.h>
@ -62,7 +62,6 @@ ATF_TC_HEAD(loopmtu, tc)
ATF_TC_BODY(loopmtu, tc)
{
char ifname[IFNAMSIZ];
size_t len;
struct {
struct rt_msghdr m_rtm;
struct sockaddr_in m_sin;

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_connect.c,v 1.3 2010/06/12 15:01:04 wiz Exp $ */
/* $NetBSD: t_connect.c,v 1.4 2010/11/03 16:10:25 christos Exp $ */
/*
* Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
* All rights reserved.
@ -74,10 +74,11 @@ ATF_TC_BODY(low_port, tc)
sin.sin_family = AF_INET;
if (connect(sd, (struct sockaddr *)&sin, sizeof(sin)) == -1) {
int err = errno;
int serrno = errno;
atf_tc_fail("connect failed: %s%s",
strerror(err),
err != EACCES ? "" : " (see http://mail-index.netbsd.org/"
strerror(serrno),
serrno != EACCES ? "" :
" (see http://mail-index.netbsd.org/"
"source-changes/2007/12/16/0011.html)");
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_listen.c,v 1.1 2008/05/01 15:38:17 jmmv Exp $ */
/* $NetBSD: t_listen.c,v 1.2 2010/11/03 16:10:25 christos Exp $ */
/*
* Copyright (c) 2007 The NetBSD Foundation, Inc.
* All rights reserved.
@ -54,10 +54,11 @@ ATF_TC_BODY(low_port, tc)
atf_tc_fail("setsockopt failed: %s", strerror(errno));
if (listen(sd, 5) == -1) {
int err = errno;
int serrno = errno;
atf_tc_fail("listen failed: %s%s",
strerror(err),
err != EACCES ? "" : " (see http://mail-index.netbsd.org/"
strerror(serrno),
serrno != EACCES ? "" :
" (see http://mail-index.netbsd.org/"
"source-changes/2007/12/16/0011.html)");
}
@ -67,4 +68,5 @@ ATF_TC_BODY(low_port, tc)
ATF_TP_ADD_TCS(tp)
{
ATF_TP_ADD_TC(tp, low_port);
return 0;
}

1
tests/rump/Makefile.inc Normal file
View File

@ -0,0 +1 @@
.include "../Makefile.inc"

1
tests/util/Makefile.inc Normal file
View File

@ -0,0 +1 @@
.include "../Makefile.inc"

View File

@ -1,4 +1,4 @@
/* $NetBSD: getmntinfo.c,v 1.3 2008/04/28 20:24:12 martin Exp $ */
/* $NetBSD: getmntinfo.c,v 1.4 2010/11/03 16:10:25 christos Exp $ */
/*
* Copyright (c) 2007 The NetBSD Foundation, Inc.
* All rights reserved.
@ -179,7 +179,7 @@ setup_strpct(void)
* Parameter taken from:
* http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=23600
*/
void
static void
setup_pr23600(void)
{
static const struct statvfs tmpl = {

View File

@ -1,4 +1,4 @@
/* $NetBSD: pwgr.c,v 1.2 2008/04/28 20:24:12 martin Exp $ */
/* $NetBSD: pwgr.c,v 1.3 2010/11/03 16:10:26 christos Exp $ */
/*
* Copyright (c) 2007 The NetBSD Foundation, Inc.
* All rights reserved.
@ -39,6 +39,7 @@
#include <grp.h>
#include <pwd.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
char Login[16];
@ -89,10 +90,10 @@ getgrgid(gid_t gid)
memset(g, 0, sizeof(*g));
if (gid == 0) {
g->gr_name = "wheel";
g->gr_name = __UNCONST("wheel");
g->gr_gid = 0;
} else if (gid == 100) {
g->gr_name = "users";
g->gr_name = __UNCONST("users");
g->gr_gid = 100;
} else
g = NULL;
@ -101,11 +102,11 @@ getgrgid(gid_t gid)
}
int
getgrouplist(const char *name, int basegid, int *groups, int *ngroups)
getgrouplist(const char *name, gid_t basegid, gid_t *groups, int *ngroups)
{
int cnt, ret;
if (name == "root") {
if (strcmp(name, "root") == 0) {
if (*ngroups >= 1) {
groups[0] = basegid;
cnt = 1;
@ -113,7 +114,7 @@ getgrouplist(const char *name, int basegid, int *groups, int *ngroups)
ret = (*ngroups >= cnt) ? 0 : -1;
*ngroups = cnt;
} else if (name == "test") {
} else if (strcmp(name, "test") == 0) {
if (*ngroups >= 1) {
groups[0] = basegid;
cnt = 1;
@ -152,11 +153,11 @@ getpwnam(const char *login)
memset(p, 0, sizeof(*p));
if (strcmp(login, "root") == 0) {
p->pw_name = "root";
p->pw_name = __UNCONST("root");
p->pw_uid = 0;
p->pw_gid = 0;
} else if (strcmp(login, "test") == 0) {
p->pw_name = "test";
p->pw_name = __UNCONST("test");
p->pw_uid = 100;
p->pw_gid = 100;
} else
@ -172,11 +173,11 @@ getpwuid(uid_t uid)
memset(p, 0, sizeof(*p));
if (uid == 0) {
p->pw_name = "root";
p->pw_name = __UNCONST("root");
p->pw_uid = 0;
p->pw_gid = 0;
} else if (uid == 100) {
p->pw_name = "test";
p->pw_name = __UNCONST("test");
p->pw_uid = 100;
p->pw_gid = 100;
} else