OLD | NEW |
1 #include "pwf.h" | 1 #include "pwf.h" |
2 | 2 |
3 #define LINE_LIM 256 | 3 #define LINE_LIM 256 |
4 | 4 |
5 struct spwd *getspnam(const char *name) | 5 struct spwd* getspnam(const char* name) { |
6 { | 6 static struct spwd sp; |
7 » static struct spwd sp; | 7 static char* line; |
8 » static char *line; | 8 struct spwd* res; |
9 » struct spwd *res; | 9 int e; |
10 » int e; | |
11 | 10 |
12 » if (!line) line = malloc(LINE_LIM); | 11 if (!line) |
13 » if (!line) return 0; | 12 line = malloc(LINE_LIM); |
14 » e = getspnam_r(name, &sp, line, LINE_LIM, &res); | 13 if (!line) |
15 » if (e) errno = e; | 14 return 0; |
16 » return res; | 15 e = getspnam_r(name, &sp, line, LINE_LIM, &res); |
| 16 if (e) |
| 17 errno = e; |
| 18 return res; |
17 } | 19 } |
OLD | NEW |