home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.linux
- Path: sparky!uunet!usc!sol.ctr.columbia.edu!eff!world!jrs
- From: jrs@world.std.com (Rick Sladkey)
- Subject: Re: Quick fix to "unknown option...ignored" problem with mount
- In-Reply-To: scott@natinst.com's message of 27 Aug 92 13:50:52 GMT
- Message-ID: <JRS.92Aug27233020@lepton.world.std.com>
- Lines: 132
- Sender: jrs@world.std.com (Rick Sladkey)
- Organization: The Internet
- References: <1992Aug27.135052.16596@natinst.com>
- Date: Fri, 28 Aug 1992 03:30:20 GMT
-
- >>>>> On 27 Aug 92 13:50:52 GMT, scott@natinst.com (Scott A. Taylor) said:
-
- Scott> I was having the same problem with "mount" from tsx-11 that
- Scott> others have recently posted about: mounting a filesystem
- Scott> without specifying any options to the mount command resulted in
- Scott> the mount displaying the message "Unknown option '<some random
- Scott> non-ascii characters>' ignored". While apparently harm- less,
- Scott> the message was kind of annoying. I did some detective work
- Scott> and found that the problem was with strdup() not correctly
- Scott> handling NULL pointers. I have included my fix below.
-
- The function strdup is not supposed to handle NULL. Nevertheless,
- it could, and it might avoid some problems. On the other hand,
- it might hide some bugs that would show up on other machines.
-
- There are several bugs in the mount-src.tar.Z available from
- tsx-11.mit.edu. Doug Quale <quale@saavik.cs.wics.edu> is rumored to
- be updating his source but it is not yet available.
-
- There are three main bugs.
-
- * strtok is called with NULL arguments without ever being primed
-
- * make_absolute inadvertently runs past the end of the string
-
- * the mount call in libc.a from gcc-2.2.2 does not support five arguments
-
- Here is a patch. Use gcc-2.2.2d to get the five argument mount syscall.
-
- Rick
- -----
- diff -rc ../old-mount/mount.c ./mount.c
- *** ../old-mount/mount.c Tue Jul 14 10:25:38 1992
- --- ./mount.c Thu Jul 23 19:51:58 1992
- ***************
- *** 205,216 ****
- int mask = 0;
- char *options, *opt;
-
- ! if ((options = strdup (opts)) == NULL)
- ! die (2, "mount: out of space");
- ! for (opt = strtok (options, ",");
- ! opt != NULL;
- ! opt = strtok (NULL, ","))
- ! mask_opt (opt, &mask);
-
- if (readonly)
- mask |= MNT_RDONLY;
- --- 205,218 ----
- int mask = 0;
- char *options, *opt;
-
- ! if (opts) {
- ! if ((options = strdup (opts)) == NULL)
- ! die (2, "mount: out of space");
- ! for (opt = strtok (options, ",");
- ! opt != NULL;
- ! opt = strtok (NULL, ","))
- ! mask_opt (opt, &mask);
- ! }
-
- if (readonly)
- mask |= MNT_RDONLY;
- ***************
- *** 375,387 ****
- die (2, "the -r and -w options conflict\n%s", usage);
-
- /* Parse the -t types into an array of null terminated strings. */
- ! for ((type = vfstypes, *type = strtok (types, ","));
- ! ((*type = strtok (NULL, ",")) != NULL)
- ! && (type < vfstypes+MAXTYPES);
- ! ++type)
- ! ;
- ! if (type >= vfstypes+MAXTYPES)
- ! die (2, "too many types specified in -t option\n%s", usage);
-
- open_mtab();
-
- --- 377,391 ----
- die (2, "the -r and -w options conflict\n%s", usage);
-
- /* Parse the -t types into an array of null terminated strings. */
- ! if (types) {
- ! for ((type = vfstypes, *type = strtok (types, ","));
- ! ((*type = strtok (NULL, ",")) != NULL)
- ! && (type < vfstypes+MAXTYPES);
- ! ++type)
- ! ;
- ! if (type >= vfstypes+MAXTYPES)
- ! die (2, "too many types specified in -t option\n%s", usage);
- ! }
-
- open_mtab();
-
- ***************
- *** 420,426 ****
- }
-
- close_mtab ();
- ! /* Changing _exit to exit causes mount to die horribly with a
- ! segmentation fault in exit(3) -- I don't know why. */
- ! _exit (status);
- }
- --- 424,428 ----
- }
-
- close_mtab ();
- ! exit (status);
- }
- diff -rc ../old-mount/mount_util.c ./mount_util.c
- *** ../old-mount/mount_util.c Tue Jul 14 09:25:59 1992
- --- ./mount_util.c Thu Jul 23 19:46:56 1992
- ***************
- *** 61,67 ****
- *++p = '/';
- }
-
- ! while (path && (p < absolute + PATH_MAX))
- if (*p == '/')
- {
- if (path[0] == '/')
- --- 61,67 ----
- *++p = '/';
- }
-
- ! while (*path && (p < absolute + PATH_MAX))
- if (*p == '/')
- {
- if (path[0] == '/')
- --
- Rick Sladkey
- jrs@world.std.com
-