~ubuntu-branches/ubuntu/trusty/keepalived/trusty

« back to all changes in this revision

Viewing changes to keepalived/core/daemon.c

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2009-05-12 20:26:15 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20090512202615-k850bw35qpuvpq4p
Tags: 1.1.17-1ubuntu1
* Merge from debian unstable, remaining changes:
  - debian/rules: DEB_UPDATE_RCD_PARAMS := expicit init start/stop
    parameters (don't stop at 0 and 6)
  - debian/init.d: init script header adapted to stop rule
  - debian/keepalived.postinst: Remove shutdown and reboot links

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 *
6
6
 * Part:        Main program structure.
7
7
 *
8
 
 * Version:     $Id: main.c,v 1.1.15 2007/09/15 04:07:41 acassen Exp $
 
8
 * Version:     $Id: main.c,v 1.1.17 2009/03/05 01:31:12 acassen Exp $
9
9
 *
10
10
 * Author:      Alexandre Cassen, <acassen@linux-vs.org>
11
11
 *
19
19
 *              as published by the Free Software Foundation; either version
20
20
 *              2 of the License, or (at your option) any later version.
21
21
 *
22
 
 * Copyright (C) 2001-2007 Alexandre Cassen, <acassen@freebox.fr>
 
22
 * Copyright (C) 2001-2009 Alexandre Cassen, <acassen@freebox.fr>
23
23
 */
24
24
 
25
25
#include <syslog.h>
26
26
#include "daemon.h"
 
27
#include "logger.h"
27
28
#include "utils.h"
28
29
 
29
30
/* Daemonization function coming from zebra source code */
35
36
        /* In case of fork is error. */
36
37
        pid = fork();
37
38
        if (pid < 0) {
38
 
                syslog(LOG_INFO, "xdaemon: fork error");
 
39
                log_message(LOG_INFO, "xdaemon: fork error");
39
40
                return -1;
40
41
        }
41
42
 
50
51
        /* Become session leader and get pid. */
51
52
        pid = setsid();
52
53
        if (pid < -1) {
53
 
                syslog(LOG_INFO, "xdaemon: setsid error");
 
54
                log_message(LOG_INFO, "xdaemon: setsid error");
54
55
                return -1;
55
56
        }
56
57