[Ocfs2-devel] [PATCH] ocfs2-tools: add error message to mount.ocfs2 when mount point is invalid.
Coly Li
coyli at suse.de
Thu Jul 31 18:29:34 PDT 2008
Joel Becker Wrote:
> On Thu, Jul 31, 2008 at 09:40:21PM +0800, Coly Li wrote:
>> diff --git a/mount.ocfs2/mount.ocfs2.c b/mount.ocfs2/mount.ocfs2.c
>> index a97b4cb..eb8e336 100644
>> --- a/mount.ocfs2/mount.ocfs2.c
>> +++ b/mount.ocfs2/mount.ocfs2.c
>> @@ -382,9 +382,21 @@ int main(int argc, char **argv)
>> o2cb_complete_group_join(&cluster, &desc, errno);
>> }
>> block_signals (SIG_UNBLOCK);
>> - com_err(progname, ret, "while mounting %s on %s. "
>> - "Check 'dmesg' for more information on this error.",
>> - mo.dev, mo.dir);
>> +
>> + /* complain mount failure */
>> + if (lstat(mo.dir, &statbuf))
>> + com_err(progname, 0, "mount point %s does not "
>> + "exist", mo.dir);
>> + else if (stat(mo.dir, &statbuf))
>> + com_err(progname, 0, "mount point %s is a "
>> + "symbolic link to nowhere", mo.dir);
>> + else if (stat(mo.dir, &statbuf) || !S_ISDIR(statbuf.st_mode))
> + else if (!S_ISDIR(statbuf.st_mode))
>
> You successfully called stat in the previous "else if" clause.
wow, thanks for catching this :)
>
>> + com_err(progname, 0, "mount point %s is not "
>> + "a directory", mo.dir);
>> + else
>> + com_err(progname, ret, "while mounting %s on %s. "
>> + "Check 'dmesg' for more information on this "
>> + "error.", mo.dev, mo.dir);
>
> Also, I agree with sunil's "broken symbolic link" text.
patch modified and resend to ocfs2-tools-devel again.
--
Coly Li
SuSE PRC Labs
More information about the Ocfs2-devel
mailing list