[uClibc-cvs] uClibc/libc/misc/ttyent getttyent.c,1.4,1.5
Manuel Novoa III
mjn3 at uclibc.org
Fri May 7 10:22:54 UTC 2004
Update of /var/cvs/uClibc/libc/misc/ttyent
In directory nail:/tmp/cvs-serv16864
Modified Files:
getttyent.c
Log Message:
"Fix" this so that at least things will link when threading is disabled.
Also fix the sizeof() issue since the change to a dynamicly allocated buf.
Note! This is still broken wrt threading, but so is the glibc version.
I'm just commiting this for new until I can test my rewrite.
Index: getttyent.c
===================================================================
RCS file: /var/cvs/uClibc/libc/misc/ttyent/getttyent.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- a/getttyent.c 18 Mar 2004 11:12:34 -0000 1.4
+++ b/getttyent.c 7 May 2004 10:22:52 -0000 1.5
@@ -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 @@
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);
}
/* skip lines that are too big */
@@ -159,7 +163,7 @@
break;
}
/* We can release the lock only here since `zapchar' is global. */
- funlockfile(tf);
+ __STDIO_ALWAYS_THREADUNLOCK(tf);
if (zapchar == '#' || *p == '#')
while ((c = *++p) == ' ' || c == '\t')
More information about the uClibc-cvs
mailing list