[server] main: Do not overwrite PID file.

Yes, we have checked if we have PID file, but we should do this
without a hole.  Use "x" mode to check the pid file atomically.
Note that "x" is not in POSIX.  We might want to use open(2) &
fdopen(3).

Signed-off-by: YOSHIFUJI Hideaki <hideaki.yoshifuji@miraclelinux.com>
[server] main: Do not check pid file twice.

It is enough to check in daemonize().

Signed-off-by: YOSHIFUJI Hideaki <hideaki.yoshifuji@miraclelinux.com>
[server] main: Remove PID file if daemon() failed.

Signed-off-by: YOSHIFUJI Hideaki <hideaki.yoshifuji@miraclelinux.com>
Merge pull request #664 from project-hatohol/pidfile-20141002a

Pidfile 20141002a