[Ocfs2-tools-devel] [PATCH 25/25] mount.ocfs2: Validate mount path before mount

Joel Becker Joel.Becker at oracle.com
Wed Jun 23 20:42:54 PDT 2010


On Wed, Jun 23, 2010 at 11:44:35AM -0700, Sunil Mushran wrote:
> +	/* validate mount dir */
> +	if (lstat(mo.dir, &statbuf))
> +		com_err(progname, 0, "mount directory %s does not exist",
> +			mo.dir);
> +	else if (stat(mo.dir, &statbuf))
> +		com_err(progname, 0, "mount directory %s is a broken symbolic "
> +			"link", mo.dir);
> +	else if (!S_ISDIR(statbuf.st_mode))
> +		com_err(progname, 0, "mount directory %s is not a directory",
> +			mo.dir);

	Why aren't you exiting with an error code here?  I can't see any
reason to continue through the rest of the mount attempt once you know
it's going to fail.

Joel

-- 

Life's Little Instruction Book #407

	"Every once in a while, take the scenic route."

Joel Becker
Consulting Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127



More information about the Ocfs2-tools-devel mailing list