~ubuntu-branches/ubuntu/lucid/timidity/lucid

« back to all changes in this revision

Viewing changes to timidity/timidity.c

  • Committer: Bazaar Package Importer
  • Author(s): Joost Yervante Damad
  • Date: 2009-09-16 13:53:56 UTC
  • Revision ID: james.westby@ubuntu.com-20090916135356-6dk3fs1flgbgk0os
Tags: 2.13.2-36
Make sure stop is only invoked when init.d script actually
exists (Closes: #546815)

Show diffs side-by-side

added added

removed removed

Lines of Context:
5127
5127
{
5128
5128
    int i, cmderr = 0;
5129
5129
 
 
5130
    /* If we're going to fork for daemon mode, we need to fork now, as
 
5131
       certain output libraries (pulseaudio) become unhappy if initialized
 
5132
       before forking and then being used from the child. */
 
5133
    if (ctl->id_character == 'A' && (ctl->flags & CTLF_DAEMONIZE))
 
5134
    {
 
5135
        int pid = fork();
 
5136
        FILE *pidf;
 
5137
        switch (pid)
 
5138
        {
 
5139
            case 0:             // child is the daemon
 
5140
                break;
 
5141
            case -1:            // error status return
 
5142
                exit(7);
 
5143
            default:            // no error, doing well
 
5144
                if ((pidf = fopen( "/var/run/timidity/timidity.pid", "w" )) != NULL )
 
5145
                {
 
5146
                    fprintf( pidf, "%d\n", pid );
 
5147
                    fclose( pidf );
 
5148
                }
 
5149
                exit(0);
 
5150
        }
 
5151
    }
 
5152
 
5130
5153
    if(play_mode == &null_play_mode)
5131
5154
    {
5132
5155
        char *output_id;