I use the `system` function to execute a linux command in my 
device which use openwrt distribution as embedded OS.

> 
> int system(const char \*command);
> 
> 
> 

my program is like below 

```
int check_file_dir(char *name)
{
    int i = 0;
    char command[128];
    sprintf(command, "ls /etc/config/%s &> /dev/null", name);
    printf("====> command =%s \n", command);
    i = system(command);
    return i;
}

void get_file_info () 
{
char name[128]; 
struct dirent *d_file;
struct stat attr;
char path[128];
char s_now[sizeof "AAAA-MM-JJTHH:MM:SS.000Z"];

   if ((dir = opendir ("/etc/config/")) != NULL) 
   {
        while ((d_file = readdir (dir)) != NULL) 
        {
            if(d_file->d_name[0] == '.')
                continue;
            sprintf(path, "/etc/config/%s", d_file->d_name);
            stat(path, &attr);
            strftime(s_now, sizeof s_now, "%Y-%m-%dT%H:%M:%S.000Z", localtime(&attr.st_mtime));
        }
    }
    closedir (dir);
    int j;
    for (j = 0; j< FILE_NUMBER; j++)
    {
       sprintf(name, "/etc/config/file%d", j); 
       if(check_file_dir(name) !=0)
           printf("file doesn't exist \n");
    }
}

 void main () 
{
get_file_info();
get_file_info();
}

```

the problem is cause by `system` function when `get_file_info()` is called twice!

they is any precautions to take to avoid system seg fault ?