On 13 January 2017 at 17:02, Felix Fietkau <n...@nbd.name> wrote:
> On 2017-01-11 12:54, Yousong Zhou wrote:
>> The kernel may invocate user mode modprobe with the following scheme
>>
>>     modprobe -q -- <module_name>
>>
>> Signed-off-by: Yousong Zhou <yszhou4t...@gmail.com>
>> ---
>>  kmodloader.c | 13 +++++++++++--
>>  1 file changed, 11 insertions(+), 2 deletions(-)
>>
>> diff --git a/kmodloader.c b/kmodloader.c
>> index b20de6e..b5dc4d1 100644
>> --- a/kmodloader.c
>> +++ b/kmodloader.c
>> @@ -719,8 +719,17 @@ static int main_modprobe(int argc, char **argv)
>>  {
>>       struct module *m;
>>       char *name;
>> +     char *mod = NULL;
>> +     int i;
>>
>> -     if (argc != 2)
>> +     if (argc < 2)
>> +             return print_usage("modprobe");
>> +     for (i = 1; i < argc; i++)
>> +             if (argv[i][0] != '-') {
> Wouldn't it make more sense to use getopt here and fail on invalid options?
>
> - Felix
>

I thought the code intended to be minimal and options are not part of
the game.  That's why all options are just ignored like above.  Though
the argc < 2 check could have been dropped...

If we accept -q and reject others, that means we will introduce a
global quiet flag and will really be quiet?  Or can we depend on
current behaviour of ulog_open(channels=0) to effectively close all
ULOG_XXX channels?

                yousong

_______________________________________________
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev

Reply via email to