|
@@ -34,6 +34,10 @@
|
|
|
#include <stdio_ext.h>
|
|
|
#include <ctype.h>
|
|
|
#include <string.h>
|
|
|
+#include <stdlib.h>
|
|
|
+#ifdef __UCLIBC_HAS_THREADS__
|
|
|
+#include <pthread.h>
|
|
|
+#endif
|
|
|
|
|
|
static char zapchar;
|
|
|
static FILE *tf;
|
|
@@ -110,11 +114,11 @@ struct ttyent * getttyent(void)
|
|
|
abort();
|
|
|
}
|
|
|
|
|
|
- flockfile (tf);
|
|
|
+ __STDIO_ALWAYS_THREADLOCK(tf);
|
|
|
|
|
|
for (;;) {
|
|
|
- if (!fgets_unlocked(p = line, sizeof(line), tf)) {
|
|
|
- funlockfile (tf);
|
|
|
+ if (!fgets_unlocked(p = line, BUFSIZ, tf)) {
|
|
|
+ __STDIO_ALWAYS_THREADUNLOCK(tf);
|
|
|
return (NULL);
|
|
|
}
|
|
|
|
|
@@ -159,7 +163,7 @@ struct ttyent * getttyent(void)
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- funlockfile(tf);
|
|
|
+ __STDIO_ALWAYS_THREADUNLOCK(tf);
|
|
|
|
|
|
if (zapchar == '#' || *p == '#')
|
|
|
while ((c = *++p) == ' ' || c == '\t')
|