Changeset 80055514 in rtems


Ignore:
Timestamp:
Nov 14, 2014, 10:09:39 AM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
6935428
Parents:
b471854b
git-author:
Sebastian Huber <sebastian.huber@…> (11/14/14 10:09:39)
git-committer:
Sebastian Huber <sebastian.huber@…> (11/20/14 09:30:21)
Message:

libcsupport: Use pthread_once()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libcsupport/src/pwdgrp.c

    rb471854b r80055514  
    3232#include <limits.h>
    3333#include <ctype.h>
     34#include <pthread.h>
    3435
    3536#include <rtems/seterr.h>
     
    3738#include "pwdgrp.h"
    3839
     40static pthread_once_t pwdgrp_once = PTHREAD_ONCE_INIT;
     41
    3942/**
    4043 *  Initialize useable but dummy databases
    4144 */
    42 void _libcsupport_pwdgrp_init(void)
     45static void pwdgrp_init(void)
    4346{
    4447  FILE *fp;
    45   static char etc_passwd_initted = 0;
    46 
    47   if (etc_passwd_initted)
    48     return;
    49   etc_passwd_initted = 1;
     48
    5049  mkdir("/etc", 0777);
    5150
     
    7574    fclose(fp);
    7675  }
     76}
     77
     78void _libcsupport_pwdgrp_init(void)
     79{
     80  pthread_once(&pwdgrp_once, pwdgrp_init);
    7781}
    7882
Note: See TracChangeset for help on using the changeset viewer.