I gave her medicine to keep from falling sick.
Is this sentence right?
Intended meaning is that I have a friend who is not feeling well therefore, I gave her medicine so that she will not be sick.
I took medicines from her to keep from falling sick.
Is this sentence right considering the intended meaning - I am not feeling well. And I want to keep from falling sick. therefore, I took medicines from her.
For me they both sound right and seems to convet the intended meaning which is clear from context. But the issue is that I have learnt that infinitive modifies the subject of the sentence. For example (see the link) here it is suggested that infinitive modifies to the subject only. Therefore, we need to rewrite the sentence. Passive form of a sentence that has "promise to [verb]"
Please let me know how infinitive modifier works? Can it go to object or not? OR depending on the meaning it can modify anything. If that's the case then both of these sentences should be right.