| 97 | |
| 98 | |
| 99 | int group2gid(int* gid, char* group) |
| 100 | { |
| 101 | char* tmp; |
| 102 | struct group *gr_entry; |
| 103 | |
| 104 | if (group){ |
| 105 | *gid=strtol(group, &tmp, 10); |
| 106 | if ((tmp==0) ||(*tmp)){ |
| 107 | /* maybe it's a string */ |
| 108 | gr_entry=getgrnam(group); |
| 109 | if (gr_entry==0){ |
| 110 | goto error; |
| 111 | } |
| 112 | *gid=gr_entry->gr_gid; |
| 113 | } |
| 114 | return 0; |
| 115 | } |
| 116 | error: |
| 117 | return -1; |
| 118 | } |
| 119 | |
| 120 | /* utility function to give each children a unique seed */ |
| 121 | void seed_child(unsigned int seed) |
no outgoing calls
no test coverage detected