mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-08-28 18:31:41 +08:00
libcsupport: Use pthread_once()
This commit is contained in:
@@ -31,22 +31,21 @@
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <ctype.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include <rtems/seterr.h>
|
||||
|
||||
#include "pwdgrp.h"
|
||||
|
||||
static pthread_once_t pwdgrp_once = PTHREAD_ONCE_INIT;
|
||||
|
||||
/**
|
||||
* Initialize useable but dummy databases
|
||||
*/
|
||||
void _libcsupport_pwdgrp_init(void)
|
||||
static void pwdgrp_init(void)
|
||||
{
|
||||
FILE *fp;
|
||||
static char etc_passwd_initted = 0;
|
||||
|
||||
if (etc_passwd_initted)
|
||||
return;
|
||||
etc_passwd_initted = 1;
|
||||
mkdir("/etc", 0777);
|
||||
|
||||
/*
|
||||
@@ -76,6 +75,11 @@ void _libcsupport_pwdgrp_init(void)
|
||||
}
|
||||
}
|
||||
|
||||
void _libcsupport_pwdgrp_init(void)
|
||||
{
|
||||
pthread_once(&pwdgrp_once, pwdgrp_init);
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract a string value from the database
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user