Excuse me, but I didn't understand what you are worrying.
I'm saying that:
If n == 0, the condition "if (n == table->ctl_name)" is always false
because of previous "if (!table->ctl_name) continue;" statement
regardless of the result whether ->ctl_name and/or ->procname are valid or not.
Thus, they always return -ENOTDIR if n == 0.
Why this optimization destroys something?
Should "if (!table->ctl_name)" be
for ( ; table->ctl_name || table->procname; table++) {
- if (!table->ctl_name)
+ if (!table->procname)
continue;
if (n == table->ctl_name) {
int error;
if (table->child) {
or something?
Regards.
-