adamyg/grief

Mac: vfork

Opened this issue · 1 comments

'vfork' is deprecated: Use posix_spawn or fork [-Wdeprecated-declarations]

   #define  _GNU_SOURCE /*top*/
   #if defined(POSIX_SPAWN_USEVFORK) || defined(__GLIBC__) /* force USEVFORK on GNU libc */
	flags |= POSIX_SPAWN_USEVFORK;
   #endif
   	posix_spawn_file_actions_t fops;
	posix_spawnattr_t attr;
	sigset_t mask;
	
   	posixspawn_file_actions_init(&fops, options);
	posix_spawnattr_init(&attr);
	flags |= POSIX_SPAWN_SETSIGMASK; /* child does not block any signals */
	sigemptyset(&mask);
	posix_spawnattr_setsigmask(&attr, &mask);
	flags |= POSIX_SPAWN_SETSIGDEF;  /* child reverts SIGPIPE handler to the default. */
	sigaddset(&mask, SIGPIPE);
	posix_spawnattr_setsigdefault(&attr, &mask);  
        posixspawn_set_pgroup(options, &attr, &flags);
        posix_spawnattr_setflags(&attr, flags);    
            posix_spawnp(&pid, file, &fops, &attr, argv, envp ? envp : environ /*global*/);
                 chdir(cwd)  [optional]
        posix_spawn_file_actions_destroy(&fops);
        posix_spawnattr_destroy(&attr); 

also replace mktemp()