Hi All,

Due to some issue with my email account, changing my email to
ak.ashwini1...@gmail.com

I came across a bug in pidof command. The issue is
with _-o_ option. callback function returns _1_ for omit
list, to names_to_pid().

names_to_pid(), breaks the internal _for_ loop, at the same
time it also breaks out of the _while(readdir())_ loop.
Which is causing the issue, as other pids are not searched for.

for (curname = names; *curname; curname++)
      if (**curname == '/' ? !strcmp(cmd, *curname)
          : !strcmp(basename(cmd), basename(*curname)))
        if (callback(u, *curname)) break;
-    if (*curname) break;
}

Why break from _while_ loop, as there can be other processes in the list
waiting for actioin.
removing this fixes the issue.

_names_to_pid()_ is also used by _killall_. killall also has issues,

1. the exit status is always > 0, thats because of toys.exitval++
in _main() function. Exit status need to be corrected.
2. No error/warning message is displayed for a non-exiting process.
as is one by GNU implementation. instead due to the _toys.exitval++_
its always printing __ No such process __ without any process name.

In order not to modify the lib function _names_to_pid_ too much, these
killall
issues could be fixed from callback function _kill_process()_.

For printing the warning message for non existent processes, can have a map
for the processes which are signalled thru _kill_process_ and finally once
_names_to_pid_ returns, print the message for non-signalled processes.

Like to have your opinion.

regards,
Ashwini Sharma
_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to