[Bug 456806] Re: mountall vomits a shell onto virtual console when you run vi
Laurent Birtz
laurent.birtz at kryptiva.com
Mon Jan 4 16:57:06 GMT 2010
Demonize code:
/* Become daemon */
if (daemonise) {
pid_t pid;
/* Fork once because Upstart makes us a session leader,
* or we may be a session leader of an existing process
* group.
*/
pid = fork ();
if (pid < 0) {
nih_fatal ("%s: %s", _("Unable to become daemon"),
strerror (errno));
exit (EXIT_ERROR);
} else if (pid > 0) {
exit (0);
}
/* Create a new session */
setsid ();
/* Fork again so that we're not the leader of that session */
pid = fork ();
if (pid < 0) {
nih_fatal ("%s: %s", _("Unable to become daemon"),
strerror (errno));
exit (EXIT_ERROR);
} else if (pid > 0) {
exit (0);
}
/* Usual daemon cleanups */
if (chdir ("/"))
;
umask (0);
/* Send all logging output to syslog */
//openlog (program_name, LOG_PID, LOG_DAEMON);
//nih_log_set_logger (nih_logger_syslog);
nih_signal_set_ignore (SIGHUP);
}
The standard input file descriptor isn't closed so mountall is still
using the terminal after the daemon is started. The daemon is thus
reading input from the terminal and modifying its settings concurrently
with whatever process is using the terminal after the launch of mountall.
On my system running 'mountall --daemon' manually will hang the shell
roughly 50% of the time. The race condition is highly
environment-dependent. Running with strace -f won't trigger the problem,
for example.
In my opinion the behavior of mountall --daemon is broken.
This bug is still present in mountall-2.1.
--
mountall vomits a shell onto virtual console when you run vi
https://bugs.launchpad.net/bugs/456806
You received this bug notification because you are a member of Ubuntu
Server Team, which is a subscriber of a duplicate bug.
More information about the Ubuntu-server-bugs
mailing list