[klibc] PATCH: ipconfig may discard useful packets
Άλκης
Άλκης
Mon Jul 14 07:15:07 PDT 2008
Answering (finally!) from gnome evolution, after spending many-many days
to find the best way to migrate 20000+ messages from outlook without
damaging their headers much! :-)
I did change more than the absolute minimum needed, but I thought it
would be safer this way, because I failed to see the reason/structure in
the return values and their handling in a lot of cases.
An example: I was trying to figure out which were the possible return
values from function do_pkt_recv in main.c:
...
ret = packet_peek(&ifindex);
if (ret < 0)
goto bail;
for (s = slist; s; s = s->next) {
if (s->dev->ifindex == ifindex) {
ret |= process_receive_event(s, now);
break;
}
}
...
I see the |= operator and I say ok, there's some value in ret that needs
to be OR'ed with.
I go to packet_peek, and I see that it can only return 0 or -1.
If it is -1, then "goto bail" gets in effect.
So, inside "for (s = slist; s; s = s->next)", ret is ALWAYS 0, and the
OR operator is not needed.
So I thought I'd replace it with the = operator to make it less cryptic.
What I'm saying is that I can send a patch with less changes if that
would be more acceptable. I just thought to clean up the code a little
bit while debugging it.
Kind regards,
Alkis Georgopoulos
Στις 14-07-2008, ημέρα Δευ, και ώρα 14:16 +0200, ο/η maximilian attems
έγραψε:
>
> the patch looks a bit scary for me as touches quite a lot
> return functions but haven't looked at the grand picture yet.
>
> kind regards
>
More information about the klibc
mailing list