home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / os / linux / 16959 < prev    next >
Encoding:
Text File  |  1992-11-17  |  1.5 KB  |  42 lines

  1. Newsgroups: comp.os.linux
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!ira.uka.de!math.fu-berlin.de!unidui!Germany.EU.net!mcsun!news.funet.fi!funic!nntp.hut.fi!nntp!jem
  3. From: jem@snakemail.hut.fi (Johan Myreen)
  4. Subject: Re: minicom broken under .98-5
  5. In-Reply-To: dohm@magnus.acs.ohio-state.edu's message of Tue, 17 Nov 1992 06:27:28 GMT
  6. Message-ID: <JEM.92Nov17121516@lk-hp-6.hut.fi>
  7. Sender: usenet@nntp.hut.fi (Usenet pseudouser id)
  8. Nntp-Posting-Host: lk-hp-6.hut.fi
  9. Organization: Helsinki University of Technology, Finland
  10. References: <1992Nov17.062728.28748@magnus.acs.ohio-state.edu>
  11. Date: 17 Nov 92 10:15:16 GMT
  12. Lines: 28
  13.  
  14. In article <1992Nov17.062728.28748@magnus.acs.ohio-state.edu> dohm@magnus.acs.ohio-state.edu (Peter J Dohm) writes:
  15.  
  16. >text segment protection.  For one, there was a line in function win_init
  17. >in window.c that had:
  18. >char *gname = "stuff"
  19. >then later:
  20. >gname[1]='x';
  21. >this seg faulted... (no kidding, right?)
  22.  
  23. >it needed to be changed to something like:
  24. >char *gname;
  25. >gname=(char *)malloc(2);  (the original string was 2 bytes in length)
  26. >strcpy(gname,"whatever");  (take the original string in the declaration and
  27.  
  28. Ugh. Simply doing this would have solved the problem:
  29.  
  30. char gname[] = "stuff";
  31.  
  32. (Well, unless gname really has to be a pointer... Poor coding style in
  33. Minicom, anyway)
  34.  
  35. This declares a char array initialized with the string, as opposed to
  36. declaring a pointer variable initialized with a pointer to a string
  37. literal.
  38.  
  39. --
  40. Johan Myreen
  41. jem@cs.hut.fi
  42.