home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / os / linux / 7000 < prev    next >
Encoding:
Text File  |  1992-07-29  |  2.3 KB  |  48 lines

  1. Newsgroups: comp.os.linux
  2. Path: sparky!uunet!news.claremont.edu!jarthur.claremont.edu!jwinstea
  3. From: jwinstea@jarthur.claremont.edu (Jim Winstead Jr.)
  4. Subject: Re: mtools, compiling problems
  5. Message-ID: <1992Jul29.233928.9415@muddcs.claremont.edu>
  6. Sender: news@muddcs.claremont.edu (The News System)
  7. Organization: Harvey Mudd College, WIBSTR
  8. References: <5561@umriscc.isc.umr.edu>
  9. Date: Wed, 29 Jul 1992 23:39:28 GMT
  10. Lines: 36
  11.  
  12. In article <5561@umriscc.isc.umr.edu> dminer@mcs213f.cs.umr.edu (Dan Miner) writes:
  13. >    Well, I finally got around to updating my system.  I got
  14. >bunches of stuff.  I have gcc 2.2.2 installed.  Now, I'm trying to 
  15. >compile the mtools (the one that is one file for all) and I got
  16. >a problem.  When linking, gcc complains that got_signal isn't there.
  17. >Well, I looked and it's true.  I find references in three files but
  18. >no where is it defined..  What's up with this?
  19.  
  20. Actually, got_signal is ifdef'ed out of some of the files, and I've
  21. never been able to get it to compile without removing the ifdef's.  In
  22. each of the files that gcc complains about, find the got_signal
  23. function that is ifdef'ed out, and remove the ifdefs.  It should link
  24. fine, then.
  25.  
  26. >Also, gcc complains about gets() in stdio.. saying that you shouldn't
  27. >use it?  Why on earth is that in there?  If you have functions that
  28. >are that unreliable, REMOVE IT!  I do believe it is ansi, so why say
  29. >something like that?  *fume*
  30.  
  31. gets() is ANSI, that is why it *has* to remain in the library.  gets()
  32. is unsafe because you cannot limit the size of the string that it
  33. reads - if you pass it an array of length 10, it will gladly write 100
  34. characters to that array and end up overwriting other data, causing a
  35. seg fault, or doing something else not very nice.
  36.  
  37. You shouldn't use gets(), but you can do so, obviously.  You would be
  38. better off replacing calls to it with fgets() or your own gets() that
  39. will correctly limit the input and not go overwriting other things.
  40.  
  41. Be glad the warning is displayed when linking, instead of at run-time
  42. like it used to.  That wasn't very nice.  :)
  43. -- 
  44.                                     +    Jim Winstead Jr. (CSci '95)
  45.                                     |            Harvey Mudd College
  46.                                     | jwinstea@jarthur.Claremont.EDU
  47.                                     + This is all my words.  Honest!
  48.