SDL_mixer icon indicating copy to clipboard operation
SDL_mixer copied to clipboard

MusicCMD_Play vs vfork

Open icculus opened this issue 2 years ago • 4 comments

MusicCMD_Play might call vfork(), depending on how the build was configured. vfork requires the child process to do nothing except call either exec*() or _exit() immediately or disaster may occur.

https://www.man7.org/linux/man-pages/man2/vfork.2.html

However, after vfork'ing, we parse a string into an array, including calling SDL_malloc().

We either need to parse this (and free it) in the parent, so it's available in the child after the vfork, or we need to ust use regular fork() here.

The perror() call in the child probably needs to go, too. It's not clear if vfork children can legally call sigprocmask. I'm guessing not.

(also, wow, let's deprecate Mix_SetMusicCMD in general.)

icculus avatar Jul 01 '22 16:07 icculus

(also, wow, let's deprecate Mix_SetMusicCMD in general.)

Oh yes - and right now is best yes?

sezero avatar Jul 01 '22 17:07 sezero

Patch to remove support for music playback using an external cmd: patch.txt

sezero avatar Jul 01 '22 18:07 sezero

The patch looks good, but please don't apply it in the 2.X series. Removal of a supported music method would be considered an ABI change.

slouken avatar Jul 01 '22 20:07 slouken

Well, pity..

sezero avatar Jul 01 '22 20:07 sezero