[KDE/Mac] chattyness & log pollution

"René J.V. Bertin" rjvbertin at gmail.com
Fri Aug 1 18:08:19 UTC 2014


>> output goes into the system log. Is there a way to avoid this from happening? I've tried replacing the bundle executable with a wrapper script that redirects both streams to /dev/null, but incomprehensibly that has no effect.

Closing stdin, stdout and stderr does have the intended effect, but of course that shouldn't be used for apps that might also be launched as filters!

int main( int argc, char *argv[] )
{ char *progName = NULL;
	errno = 0;
	asprintf( &progName, "%s.bin", argv[0] );
	if( progName ){
		fclose(stdin);
		fclose(stdout);
		fprintf( stderr, "%s launching\n", progName );
		fclose(stderr);
		argv[0]= progName;
		execv( progName, argv );
		  /* not reached unless error */
		{ FILE *fp = fopen("/dev/tty", "w");
			fprintf( fp, "%s: %s", progName, strerror(errno) );
			fclose(fp);
		}
		exit(errno);
	}
	else{
		fprintf( stderr, "We shouldn't be here: %s::%d!\n", __FILE__, __LINE__ );
		if( !errno ){
			errno = ENOMEM;
		}
	}
	exit(errno);
}



More information about the kde-mac mailing list