home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / os / linux / 9195 < prev    next >
Encoding:
Text File  |  1992-08-27  |  2.1 KB  |  61 lines

  1. Path: sparky!uunet!elroy.jpl.nasa.gov!swrinde!news.dell.com!natinst.com!scott
  2. From: scott@natinst.com (Scott A. Taylor)
  3. Newsgroups: comp.os.linux
  4. Subject: Quick fix to "unknown option...ignored" problem with mount
  5. Summary: Workaround to problem with strdup()
  6. Keywords: mount, strdup()
  7. Message-ID: <1992Aug27.135052.16596@natinst.com>
  8. Date: 27 Aug 92 13:50:52 GMT
  9. Sender: scott@natinst.com (Scott Taylor)
  10. Followup-To: comp.os.linux
  11. Distribution: comp.os.linux
  12. Organization: National Instruments, Austin, TX
  13. Lines: 45
  14. Nntp-Posting-Host: eagle.natinst.com
  15.  
  16. I was having the same problem with "mount" from tsx-11 that others have
  17. recently posted about: mounting a filesystem without specifying any options
  18. to the mount command resulted in the mount displaying the message "Unknown
  19. option '<some random non-ascii characters>' ignored".  While apparently harm-
  20. less, the message was kind of annoying.  I did some detective work and found
  21. that the problem was with strdup() not correctly handling NULL pointers.
  22. I have included my fix below.
  23.  
  24. Note that I am running 0.96c pl2 with gcc 2.2.2; has this problem with strdup()
  25. been fixed in 2.2.2d?
  26.  
  27. ----------------------------------8< cut here >8----------------------------
  28. *** mount.c.old    Mon Aug 17 21:55:31 1992
  29. --- mount.c    Mon Aug 17 23:35:34 1992
  30. ***************
  31. *** 205,215 ****
  32.     int mask = 0;
  33.     char *options, *opt;
  34.   
  35. !   if ((options = strdup (opts)) == NULL)
  36.       die (2, "mount: out of space");
  37. !   for (opt = strtok (options, ",");
  38. !        opt != NULL;
  39. !        opt = strtok (NULL, ","))
  40.       mask_opt (opt, &mask);
  41.   
  42.     if (readonly)
  43. --- 205,215 ----
  44.       int mask = 0;
  45.       char *options, *opt;
  46.   
  47. !     if (opts == NULL)
  48. !         options = "";
  49. !     else if ((options = strdup (opts)) == NULL)
  50.           die (2, "mount: out of space");
  51. !     for (opt = strtok (options, ","); opt != NULL; opt = strtok (NULL, ","))
  52.           mask_opt (opt, &mask);
  53.   
  54.       if (readonly)
  55. ----------------------------------8< cut here >8----------------------------
  56. -- 
  57. Scott Taylor            |
  58. (512) 795-6837          | "                              " -Marcelle Marceau
  59. scott@natinst.com       |
  60.          ** NI pays me to write their code, not their opinions **
  61.