In the book of Classical Mechanics by GolsteinGoldstein, at page 19, while deriving D'Alembert's principle, the author assumes that
$$\dot p = m \ddot r.$$
However, when the mass of the bodies also changes, is the principle still correct, or can be corrected ? If so, how ?