home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!elroy.jpl.nasa.gov!swrinde!news.dell.com!natinst.com!scott
- From: scott@natinst.com (Scott A. Taylor)
- Newsgroups: comp.os.linux
- Subject: Quick fix to "unknown option...ignored" problem with mount
- Summary: Workaround to problem with strdup()
- Keywords: mount, strdup()
- Message-ID: <1992Aug27.135052.16596@natinst.com>
- Date: 27 Aug 92 13:50:52 GMT
- Sender: scott@natinst.com (Scott Taylor)
- Followup-To: comp.os.linux
- Distribution: comp.os.linux
- Organization: National Instruments, Austin, TX
- Lines: 45
- Nntp-Posting-Host: eagle.natinst.com
-
- I was having the same problem with "mount" from tsx-11 that others have
- recently posted about: mounting a filesystem without specifying any options
- to the mount command resulted in the mount displaying the message "Unknown
- option '<some random non-ascii characters>' ignored". While apparently harm-
- less, the message was kind of annoying. I did some detective work and found
- that the problem was with strdup() not correctly handling NULL pointers.
- I have included my fix below.
-
- Note that I am running 0.96c pl2 with gcc 2.2.2; has this problem with strdup()
- been fixed in 2.2.2d?
-
- ----------------------------------8< cut here >8----------------------------
- *** mount.c.old Mon Aug 17 21:55:31 1992
- --- mount.c Mon Aug 17 23:35:34 1992
- ***************
- *** 205,215 ****
- 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)
- --- 205,215 ----
- int mask = 0;
- char *options, *opt;
-
- ! if (opts == NULL)
- ! options = "";
- ! else 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)
- ----------------------------------8< cut here >8----------------------------
- --
- Scott Taylor |
- (512) 795-6837 | " " -Marcelle Marceau
- scott@natinst.com |
- ** NI pays me to write their code, not their opinions **
-