mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 18:21:24 +02:00
Merge branch 'intel-sst' of https://github.com/spandruvada/linux-kernel into review-ilpo-next
This commit is contained in:
commit
d29cce4dde
|
|
@ -148,6 +148,7 @@ static void daemonize(char *rundir, char *pidfile)
|
|||
{
|
||||
int pid, sid, i;
|
||||
char str[10];
|
||||
struct stat st;
|
||||
struct sigaction sig_actions;
|
||||
sigset_t sig_set;
|
||||
int ret;
|
||||
|
|
@ -200,11 +201,17 @@ static void daemonize(char *rundir, char *pidfile)
|
|||
if (ret == -1)
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
pid_file_handle = open(pidfile, O_RDWR | O_CREAT, 0600);
|
||||
pid_file_handle = open(pidfile, O_RDWR | O_CREAT | O_NOFOLLOW, 0600);
|
||||
if (pid_file_handle == -1) {
|
||||
/* Couldn't open lock file */
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (fstat(pid_file_handle, &st) == -1)
|
||||
exit(1);
|
||||
|
||||
if (!S_ISREG(st.st_mode))
|
||||
exit(1);
|
||||
/* Try to lock file */
|
||||
#ifdef LOCKF_SUPPORT
|
||||
if (lockf(pid_file_handle, F_TLOCK, 0) == -1) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user