Re: [PATCH] xfs_quota: correctly initialise the default path

Mark Tinguely
2012-11-17T21:13:21Z

On 11/15/12 19:14, Dave Chinner wrote:
> From: Dave Chinner<dchinner@redhat.com>
>
> When we initial xfs_quota, we place lots of information into the
> fs_table. This includes all the devices/mount points the user has
> specified as a global command line parameter to report on, as well
> as all the paths under project quota control.
>
> There is a "current path" pointer (fs_path) maintained by the code
> that points somewhere into the fs_table. After the table is
> initialised, fs_path always points to the last entry in the table,
> and hence has to be re-initialised to point at the desired entry
> before it can be used properly.

...

fun code read :)

> init_commands();
> add_args_command(init_args_command);
> +
> + /*
> + * Ensure that global commands don't end up with an invalid path pointer
> + * by setting the default device at the first specified on the CLI
> + */
> + if (argc != optind)
> + fs_path = fs_table_lookup(argv[optind], FS_MOUNT_POINT);

fs_table_lookup() can return NULL - especially the way I type.

--Mark.