]> sourceware.org Git - newlib-cygwin.git/commitdiff
* libc/stdio/gets.c (_gets_r): Lock stdin here and call
authorCorinna Vinschen <corinna@vinschen.de>
Tue, 25 Nov 2008 09:33:43 +0000 (09:33 +0000)
committerCorinna Vinschen <corinna@vinschen.de>
Tue, 25 Nov 2008 09:33:43 +0000 (09:33 +0000)
__sgetc_r instead of _getchar_r.

newlib/ChangeLog
newlib/libc/stdio/gets.c

index 01f34774ff6d234c053d264358b8117b9b5cd893..e624880ee34e6cba74b4263e16a5cd7bacad774b 100644 (file)
@@ -1,3 +1,8 @@
+2008-11-25  Corinna Vinschen  <corinna@vinschen.de>
+
+       * libc/stdio/gets.c (_gets_r): Lock stdin here and call
+       __sgetc_r instead of _getchar_r.
+
 2008-11-24  Craig Howland  <howland@LGSInnovations.com>
 
        * libc/stdlib/wcstoull_r.c:  Add EINVAL return for bad base value,
index b90271fb9f3532c4eb6018c0c4647a89accad524..17d1443160c55acd4d0e97ba840d09d73cd5155d 100644 (file)
@@ -79,15 +79,20 @@ _DEFUN(_gets_r, (ptr, buf),
   register int c;
   register char *s = buf;
 
-  while ((c = _getchar_r (ptr)) != '\n')
+  _flockfile (stdin);
+  while ((c = __sgetc_r (ptr, stdin)) != '\n')
     if (c == EOF)
       if (s == buf)
-       return NULL;
+       {
+         _funlockfile (stdin);
+         return NULL;
+       }
       else
        break;
     else
       *s++ = c;
   *s = 0;
+  _funlockfile (stdin);
   return buf;
 }
 
This page took 0.050934 seconds and 5 git commands to generate.