about summary refs log tree commit diff
path: root/libio/ioungetc.c
diff options
context:
space:
mode:
Diffstat (limited to 'libio/ioungetc.c')
-rw-r--r--libio/ioungetc.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libio/ioungetc.c b/libio/ioungetc.c
index 1a6988ef16..c1237b5f9b 100644
--- a/libio/ioungetc.c
+++ b/libio/ioungetc.c
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 1993 Free Software Foundation
+Copyright (C) 1993, 1996 Free Software Foundation, Inc.
 
 This file is part of the GNU IO Library.  This library is free
 software; you can redistribute it and/or modify it under the
@@ -29,10 +29,14 @@ _IO_ungetc (c, fp)
      int c;
      _IO_FILE *fp;
 {
+  int result;
   CHECK_FILE (fp, EOF);
   if (c == EOF)
     return EOF;
-  return _IO_sputbackc (fp, (unsigned char) c);
+  _IO_flockfile (fp);
+  result = _IO_sputbackc (fp, (unsigned char) c);
+  _IO_funlockfile (fp);
+  return result;
 }
 
 weak_alias (_IO_ungetc, ungetc)