I got a shorter patch, for 5.1.4, but I don't have confidence that this is correct for other cases.
Attachment: lcode.c.diff Description: Binary data