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

  1. Newsgroups: comp.os.linux
  2. Path: sparky!uunet!usc!sol.ctr.columbia.edu!eff!world!jrs
  3. From: jrs@world.std.com (Rick Sladkey)
  4. Subject: Re: Quick fix to "unknown option...ignored" problem with mount
  5. In-Reply-To: scott@natinst.com's message of 27 Aug 92 13:50:52 GMT
  6. Message-ID: <JRS.92Aug27233020@lepton.world.std.com>
  7. Lines: 132
  8. Sender: jrs@world.std.com (Rick Sladkey)
  9. Organization: The Internet
  10. References: <1992Aug27.135052.16596@natinst.com>
  11. Date: Fri, 28 Aug 1992 03:30:20 GMT
  12.  
  13. >>>>> On 27 Aug 92 13:50:52 GMT, scott@natinst.com (Scott A. Taylor) said:
  14.  
  15. Scott> I was having the same problem with "mount" from tsx-11 that
  16. Scott> others have recently posted about: mounting a filesystem
  17. Scott> without specifying any options to the mount command resulted in
  18. Scott> the mount displaying the message "Unknown option '<some random
  19. Scott> non-ascii characters>' ignored".  While apparently harm- less,
  20. Scott> the message was kind of annoying.  I did some detective work
  21. Scott> and found that the problem was with strdup() not correctly
  22. Scott> handling NULL pointers.  I have included my fix below.
  23.  
  24. The function strdup is not supposed to handle NULL.  Nevertheless,
  25. it could, and it might avoid some problems.  On the other hand,
  26. it might hide some bugs that would show up on other machines.
  27.  
  28. There are several bugs in the mount-src.tar.Z available from
  29. tsx-11.mit.edu.  Doug Quale <quale@saavik.cs.wics.edu> is rumored to
  30. be updating his source but it is not yet available.
  31.  
  32. There are three main bugs.
  33.  
  34. * strtok is called with NULL arguments without ever being primed
  35.  
  36. * make_absolute inadvertently runs past the end of the string
  37.  
  38. * the mount call in libc.a from gcc-2.2.2 does not support five arguments
  39.  
  40. Here is a patch.  Use gcc-2.2.2d to get the five argument mount syscall.
  41.  
  42. Rick
  43. -----
  44. diff -rc ../old-mount/mount.c ./mount.c
  45. *** ../old-mount/mount.c    Tue Jul 14 10:25:38 1992
  46. --- ./mount.c    Thu Jul 23 19:51:58 1992
  47. ***************
  48. *** 205,216 ****
  49.     int mask = 0;
  50.     char *options, *opt;
  51.   
  52. !   if ((options = strdup (opts)) == NULL)
  53. !     die (2, "mount: out of space");
  54. !   for (opt = strtok (options, ",");
  55. !        opt != NULL;
  56. !        opt = strtok (NULL, ","))
  57. !     mask_opt (opt, &mask);
  58.   
  59.     if (readonly)
  60.       mask |= MNT_RDONLY;
  61. --- 205,218 ----
  62.     int mask = 0;
  63.     char *options, *opt;
  64.   
  65. !   if (opts) {
  66. !     if ((options = strdup (opts)) == NULL)
  67. !       die (2, "mount: out of space");
  68. !     for (opt = strtok (options, ",");
  69. !          opt != NULL;
  70. !          opt = strtok (NULL, ","))
  71. !       mask_opt (opt, &mask);
  72. !   }
  73.   
  74.     if (readonly)
  75.       mask |= MNT_RDONLY;
  76. ***************
  77. *** 375,387 ****
  78.       die (2, "the -r and -w options conflict\n%s", usage);
  79.   
  80.     /* Parse the -t types into an array of null terminated strings.  */
  81. !   for ((type = vfstypes, *type = strtok (types, ","));
  82. !        ((*type = strtok (NULL, ",")) != NULL)
  83. !     && (type < vfstypes+MAXTYPES);
  84. !        ++type)
  85. !     ;
  86. !   if (type >= vfstypes+MAXTYPES)
  87. !     die (2, "too many types specified in -t option\n%s", usage);
  88.   
  89.     open_mtab();
  90.   
  91. --- 377,391 ----
  92.       die (2, "the -r and -w options conflict\n%s", usage);
  93.   
  94.     /* Parse the -t types into an array of null terminated strings.  */
  95. !   if (types) {
  96. !     for ((type = vfstypes, *type = strtok (types, ","));
  97. !          ((*type = strtok (NULL, ",")) != NULL)
  98. !       && (type < vfstypes+MAXTYPES);
  99. !          ++type)
  100. !       ;
  101. !     if (type >= vfstypes+MAXTYPES)
  102. !       die (2, "too many types specified in -t option\n%s", usage);
  103. !   }
  104.   
  105.     open_mtab();
  106.   
  107. ***************
  108. *** 420,426 ****
  109.       }
  110.   
  111.     close_mtab ();
  112. !   /* Changing _exit to exit causes mount to die horribly with a
  113. !      segmentation fault in exit(3) -- I don't know why.  */
  114. !   _exit (status);
  115.   }
  116. --- 424,428 ----
  117.       }
  118.   
  119.     close_mtab ();
  120. !   exit (status);
  121.   }
  122. diff -rc ../old-mount/mount_util.c ./mount_util.c
  123. *** ../old-mount/mount_util.c    Tue Jul 14 09:25:59 1992
  124. --- ./mount_util.c    Thu Jul 23 19:46:56 1992
  125. ***************
  126. *** 61,67 ****
  127.       *++p = '/';
  128.       }
  129.   
  130. !   while (path && (p < absolute + PATH_MAX))
  131.       if (*p == '/')
  132.         {
  133.       if (path[0] == '/')
  134. --- 61,67 ----
  135.       *++p = '/';
  136.       }
  137.   
  138. !   while (*path && (p < absolute + PATH_MAX))
  139.       if (*p == '/')
  140.         {
  141.       if (path[0] == '/')
  142. --
  143. Rick Sladkey
  144. jrs@world.std.com
  145.