Page MenuHomeFreeBSD

D55310.id171973.diff
No OneTemporary

D55310.id171973.diff

diff --git a/lib/libc/rpc/getnetconfig.c b/lib/libc/rpc/getnetconfig.c
--- a/lib/libc/rpc/getnetconfig.c
+++ b/lib/libc/rpc/getnetconfig.c
@@ -118,7 +118,6 @@
#define NC_INVALID 0
-static int *__nc_error(void);
static int parse_ncp(char *, struct netconfig *);
static struct netconfig *dup_ncp(struct netconfig *);
@@ -129,46 +128,10 @@
static struct netconfig_info ni = { 0, 0, NULL, NULL};
static mutex_t ni_lock = MUTEX_INITIALIZER;
-static thread_key_t nc_key;
-static once_t nc_once = ONCE_INITIALIZER;
-static int nc_key_error;
-
-static void
-nc_key_init(void)
-{
-
- nc_key_error = thr_keycreate(&nc_key, free);
-}
+static _Thread_local int nc_error = 0;
#define MAXNETCONFIGLINE 1000
-static int *
-__nc_error(void)
-{
- static int nc_error = 0;
- int *nc_addr;
-
- /*
- * Use the static `nc_error' if we are the main thread
- * (including non-threaded programs), or if an allocation
- * fails.
- */
- if (thr_main())
- return (&nc_error);
- if (thr_once(&nc_once, nc_key_init) != 0 || nc_key_error != 0)
- return (&nc_error);
- if ((nc_addr = (int *)thr_getspecific(nc_key)) == NULL) {
- nc_addr = (int *)malloc(sizeof (int));
- if (thr_setspecific(nc_key, (void *) nc_addr) != 0) {
- free(nc_addr);
- return (&nc_error);
- }
- *nc_addr = 0;
- }
- return (nc_addr);
-}
-
-#define nc_error (*(__nc_error()))
/*
* A call to setnetconfig() establishes a /etc/netconfig "session". A session
* "handle" is returned on a successful call. At the start of a session (after

File Metadata

Mime Type
text/plain
Expires
Wed, Mar 18, 11:46 PM (3 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28815621
Default Alt Text
D55310.id171973.diff (1 KB)

Event Timeline