home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume10 / pcmail2 / patch01 < prev    next >
Text File  |  1990-02-13  |  2KB  |  73 lines

  1. Newsgroups: comp.sources.misc
  2. organization: Eindhoven University of Technology, The Netherlands
  3. keywords: sscanf() bug
  4. subject: v10i051: PC-MAIL release 2, patch 1
  5. from: wswietse@lso.win.tue.nl (Wietse Venema)
  6. Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  7.  
  8. Posting-number: Volume 10, Issue 51
  9. Submitted-by: wswietse@lso.win.tue.nl (Wietse Venema)
  10. Archive-name: pcmail2/patch01
  11.  
  12. There is a bug in some implementations of the MicroSoft C sscanf()
  13. library function that may cause the pc-mail programs to believe
  14. that there is more unread mail than there actually is. The following
  15. patch should take care of the problem. 
  16.  
  17. The sscanf() problem definitely does not exist with the UNIX versions
  18. that I compiled the software on (SunOS 4.0.3, Microport SysV/AT 2.3).
  19.  
  20. Feed the following to the patch command. If you do not have patch, the
  21. changes are quite obvious and can easily be applied by hand.
  22.  
  23. *** newseqno.c-    Mon Jan 22 13:04:30 1990
  24. --- newseqno.c    Mon Jan 29 15:50:48 1990
  25. ***************
  26. *** 30,38 ****
  27.   /* CREATION DATE
  28.   /*      Sat Mar 28 18:10:53 GMT+1:00 1987
  29.   /* LAST MODIFICATION
  30. ! /*    90/01/22 13:02:19
  31.   /* VERSION/RELEASE
  32. ! /*    2.1
  33.   /*--*/
  34.   
  35.   #include "defs.h"
  36. --- 30,38 ----
  37.   /* CREATION DATE
  38.   /*      Sat Mar 28 18:10:53 GMT+1:00 1987
  39.   /* LAST MODIFICATION
  40. ! /*    90/01/29 15:50:46
  41.   /* VERSION/RELEASE
  42. ! /*    2.2
  43.   /*--*/
  44.   
  45.   #include "defs.h"
  46. ***************
  47. *** 72,81 ****
  48.   public unsigned seqno(s)
  49.   char   *s;
  50.   {
  51. !     int     seq;
  52. !     char    junk;
  53.   
  54. !     if (strlen(s) == NAMELEN && sscanf(s + 1, "%u%c", &seq, &junk) == 1)
  55.       return (seq);
  56.       else
  57.       return (0);
  58. --- 72,84 ----
  59.   public unsigned seqno(s)
  60.   char   *s;
  61.   {
  62. !     unsigned seq;
  63. !     char    junk = 0;
  64.   
  65. !     /* MicroSoft C sscanf() does not terminate if assignment to seq fails */
  66. !     if (strlen(s) == NAMELEN && sscanf(s + 1, "%u%c", &seq, &junk) == 1
  67. !     && junk == 0)
  68.       return (seq);
  69.       else
  70.       return (0);
  71.  
  72.