Taking into account the two proposed patches, and what I believe the code to be doing, attached is a patch I believe is suitable for inclusion.
Taking into account the two proposed patches, and what I believe the code to be doing, attached is a patch I believe is suitable for inclusion.