Fix build with MSG_USE_DEPRECATED.
(cherry picked from commit f89bfaee2e744ff4516d025623b33fe11e7a544c)