CASA/c_micasad/startup/micasad-init.c
Cameron (Kamran) Mashayekhi 0e2f327e7c Fix for to the startup service problem on upgrade.
Fix for circular dependency between CASA and Gnome Keyring.
Fix for yast grey out button.
2006-05-22 21:14:34 +00:00

40 lines
733 B
C

#include <unistd.h>
#include <fcntl.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
main(int argc, char *argv[])
{
int no_fds = 0;
int fd = -1;
int rc = 0;
pid_t sid;
/*
* Fork a child process
* Exit parent
* Change directory to "/"
* Redirect stdin, stdout, stderr to "/dev/null"
*/
rc = daemon (0, 0);
if ( rc < 0 )
{
exit(EXIT_FAILURE);
}
/* Create a new session */
setsid();
/* Set the file mode creation mask */
umask(022);
/* Close the associated standard file descriptors */
close(STDIN_FILENO);
close(STDOUT_FILENO);
close(STDERR_FILENO);
/* Start micasad */
return execv ("/usr/bin/mono", argv);
}