home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / unix / sys5 / r4 / 808 < prev    next >
Encoding:
Text File  |  1992-12-12  |  1009 b   |  34 lines

  1. Newsgroups: comp.unix.sys5.r4
  2. Path: sparky!uunet!sarto!jhpb
  3. From: jhpb@sarto.budd-lake.nj.us (Joseph H. Buehler)
  4. Subject: SVR4.0.3A putw() bug
  5. Message-ID: <JHPB.92Dec12121811@sarto.budd-lake.nj.us>
  6. Sender: jhpb@sarto.budd-lake.nj.us (Joseph H Buehler)
  7. Organization: none
  8. Date: Sat, 12 Dec 1992 17:18:11 GMT
  9. Lines: 23
  10.  
  11. I have been having some problems with the GNU locate program (GNU find
  12. 3.6 and 3.7), and finally got around to debugging it.  It turns out
  13. that there is a bug in the ESIX SVR4.0.3A putw() routine in the C
  14. shared library.  The following program demonstrates it:
  15.  
  16. /* compile with: cc -o file file.c */
  17. #include <stdio.h>
  18. main()
  19. {
  20.     int i;
  21.     for (i=0; i<1022; ++i) {
  22.         putchar('1');
  23.     }
  24.     putw(-11, stdout);
  25.     for (i=0; i<1022; ++i) {
  26.         putchar('1');
  27.     }
  28. }
  29.  
  30. The putw() routine does not output 4 bytes, as it should.  I suspect
  31. there is some interaction with buffer flushing that is causing the
  32. problem.  Also, note that if you change the sign of the first argument
  33. to putw(), the program works fine.
  34.