Skip to content

Commit

Permalink
[BZ #2389]
Browse files Browse the repository at this point in the history
	* resolv/res_hconf.c: Remove 'order' parsing.  Just ignore the line.
	* resolv/res_hconf.h: Remove Name_Service definition.
	(struct hconf): Replace service related fields with placeholders.

	* version.h (VERSION): Bump to 2.4.90 for the trunk.
  • Loading branch information
Ulrich Drepper committed Apr 25, 2006
1 parent 38027f9 commit b9c65d0
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 122 deletions.
7 changes: 6 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
2006-04-25 Ulrich Drepper <drepper@redhat.com>

[BZ #2389]
* resolv/res_hconf.c: Remove 'order' parsing. Just ignore the line.
* resolv/res_hconf.h: Remove Name_Service definition.
(struct hconf): Replace service related fields with placeholders.

[BZ #2386]
* sysdeps/unix/sysv/linux/ia64/clone2.S: Check for NULL stakc
pointers to match other architectures.
Expand All @@ -26,7 +31,7 @@
* posix/tst-rfc3484.c: Include <ifaddrs.h> early.
* posix/tst-rfc3484-2.c: Likewise.

* version.h (VERSION): Bunp to 2.4.90 for the trunk.
* version.h (VERSION): Bump to 2.4.90 for the trunk.

2006-04-24 Jakub Jelinek <jakub@redhat.com>

Expand Down
119 changes: 8 additions & 111 deletions resolv/res_hconf.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 1993, 1995-2003, 2004, 2005 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1995-2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by David Mosberger (davidm@azstarnet.com).
Expand Down Expand Up @@ -53,15 +53,12 @@

/* Environment vars that all user to override default behavior: */
#define ENV_HOSTCONF "RESOLV_HOST_CONF"
#define ENV_SERVORDER "RESOLV_SERV_ORDER"
#define ENV_SPOOF "RESOLV_SPOOF_CHECK"
#define ENV_TRIM_OVERR "RESOLV_OVERRIDE_TRIM_DOMAINS"
#define ENV_TRIM_ADD "RESOLV_ADD_TRIM_DOMAINS"
#define ENV_MULTI "RESOLV_MULTI"
#define ENV_REORDER "RESOLV_REORDER"

static const char *arg_service_list (const char *, int, const char *,
unsigned int);
static const char *arg_trimdomain_list (const char *, int, const char *,
unsigned int);
static const char *arg_spoof (const char *, int, const char *, unsigned int);
Expand All @@ -75,7 +72,7 @@ static const struct cmd
unsigned int arg;
} cmd[] =
{
{"order", arg_service_list, 0},
{"order", NULL, 0},
{"trim", arg_trimdomain_list, 0},
{"spoof", arg_spoof, 0},
{"multi", arg_bool, HCONF_FLAG_MULTI},
Expand Down Expand Up @@ -106,101 +103,6 @@ skip_string (const char *str)
}


static const char *
arg_service_list (const char *fname, int line_num, const char *args,
unsigned int arg)
{
enum Name_Service service;
const char *start;
size_t len;
size_t i;
static const struct
{
const char name[6];
int16_t service;
} svcs[] =
{
{"bind", SERVICE_BIND},
{"hosts", SERVICE_HOSTS},
{"nis", SERVICE_NIS},
};

do
{
start = args;
args = skip_string (args);
len = args - start;

service = SERVICE_NONE;
for (i = 0; i < sizeof (svcs) / sizeof (svcs[0]); ++i)
{
if (__strncasecmp (start, svcs[i].name, len) == 0
&& len == strlen (svcs[i].name))
{
service = svcs[i].service;
break;
}
}
if (service == SERVICE_NONE)
{
char *buf;

if (__asprintf (&buf,
_("%s: line %d: expected service, found `%s'\n"),
fname, line_num, start) < 0)
return 0;

__fxprintf (NULL, "%s", buf);

free (buf);
return 0;
}
if (_res_hconf.num_services >= SERVICE_MAX)
{
char *buf;

if (__asprintf (&buf, _("\
%s: line %d: cannot specify more than %d services"),
fname, line_num, SERVICE_MAX) < 0)
return 0;

__fxprintf (NULL, "%s", buf);

free (buf);
return 0;
}
_res_hconf.service[_res_hconf.num_services++] = service;

args = skip_ws (args);
switch (*args)
{
case ',':
case ';':
case ':':
args = skip_ws (++args);
if (!*args || *args == '#')
{
char *buf;

if (__asprintf (&buf, _("\
%s: line %d: list delimiter not followed by keyword"),
fname, line_num) < 0)
return 0;

__fxprintf (NULL, "%s", buf);

free (buf);
return 0;
}
default:
break;
}
}
while (*args && *args != '#');
return args;
}


static const char *
arg_trimdomain_list (const char *fname, int line_num, const char *args,
unsigned int flag)
Expand Down Expand Up @@ -351,6 +253,11 @@ parse_line (const char *fname, int line_num, const char *str)
return;
}

/* Ignore lines for which no parser is set. This is used for
obsolete commands. */
if (c->parse_args == NULL)
return;

/* process args: */
str = skip_ws (str);
str = (*c->parse_args) (fname, line_num, str, c->arg);
Expand Down Expand Up @@ -396,10 +303,7 @@ do_init (void)
hconf_name = _PATH_HOSTCONF;

fp = fopen (hconf_name, "rc");
if (!fp)
/* make up something reasonable: */
_res_hconf.service[_res_hconf.num_services++] = SERVICE_BIND;
else
if (fp)
{
/* No threads using this stream. */
__fsetlocking (fp, FSETLOCKING_BYCALLER);
Expand All @@ -413,13 +317,6 @@ do_init (void)
fclose (fp);
}

envval = getenv (ENV_SERVORDER);
if (envval)
{
_res_hconf.num_services = 0;
arg_service_list (ENV_SERVORDER, 1, envval, 0);
}

envval = getenv (ENV_SPOOF);
if (envval)
arg_spoof (ENV_SPOOF, 1, envval, 0);
Expand Down
13 changes: 3 additions & 10 deletions resolv/res_hconf.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1995-1998, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by David Mosberger (davidm@azstarnet.com).
Expand All @@ -24,18 +24,11 @@

#define TRIMDOMAINS_MAX 4

enum Name_Service
{
SERVICE_NONE = 0,
SERVICE_BIND, SERVICE_HOSTS, SERVICE_NIS,
SERVICE_MAX
};

struct hconf
{
int initialized;
int num_services;
enum Name_Service service[SERVICE_MAX];
int unused1;
int unused2[4];
int num_trimdomains;
const char *trimdomain[TRIMDOMAINS_MAX];
unsigned int flags;
Expand Down
56 changes: 56 additions & 0 deletions sysdeps/unix/sysv/linux/tst-clone.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/* Test for proper error/errno handling in clone.
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */

/* BZ #2386 */
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sched.h>

int child_fn(void *arg)
{
puts ("FAIL: in child_fn(); should not be here");
exit(1);
}

static int
do_test (void)
{
int result;

#ifdef __ia64__
result = __clone2(child_fn, NULL, 0, 0, NULL, NULL, NULL);
#else
result = clone(child_fn, NULL, (int) NULL, NULL);
#endif

if (errno != EINVAL || result != -1)
{
printf ("FAIL: clone()=%d (wanted -1) errno=%d (wanted %d)\n",
result, errno, EINVAL);
return 1;
}

puts ("All OK");
return 0;
}

#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"

0 comments on commit b9c65d0

Please sign in to comment.