~ubuntu-branches/ubuntu/quantal/usplash/quantal

« back to all changes in this revision

Viewing changes to libusplash.c

  • Committer: Bazaar Package Importer
  • Author(s): Scott James Remnant
  • Date: 2009-10-15 23:18:30 UTC
  • Revision ID: james.westby@ubuntu.com-20091015231830-yp4s7hcwdg33jz9d
Tags: 0.5.45
* Make sure that when we open devices we use O_NOCTTY, since otherwise
  when run under Upstart we end up with controlling terminals that we
  didn't expect.
* Then after we've forked into a child process, we call the TIOCSCTTY
  ioctl() to take control of the terminal we're on so we get input.

Show diffs side-by-side

added added

removed removed

Lines of Context:
257
257
#ifdef SVGA
258
258
        /* Check which set of functions we should be using */
259
259
        int fd;
260
 
        fd = open("/dev/fb0", O_RDWR);
 
260
        fd = open("/dev/fb0", O_RDWR | O_NOCTTY);
261
261
        if (fd < 0) {
262
262
                usplash_operations = &usplash_svga_funcs;
263
263
                return;
270
270
void ensure_console(void)
271
271
{
272
272
        if (console_fd == -1) {
273
 
                console_fd = open("/dev/console", O_RDWR);
 
273
                console_fd = open("/dev/console", O_RDWR | O_NOCTTY);
274
274
                if (console_fd == -1) {
275
275
                        fprintf(stderr,
276
276
                                "usplash: cannot open /dev/console: %s\n",
294
294
        /* This may fail when restoring the console before exit, since the
295
295
         * initramfs has gone away; but that's OK.
296
296
         */
297
 
        saved_vt_fd = open(saved_vtname, O_RDWR);
 
297
        saved_vt_fd = open(saved_vtname, O_RDWR | O_NOCTTY);
298
298
        new_vt = vt;
299
299
 
300
300
        ioctl(vt_fd, VT_ACTIVATE, vt);
339
339
 
340
340
        assert((state.v_active >= 0) && (state.v_active < 100));
341
341
        sprintf(vtname, "/dev/tty%d", state.v_active);
342
 
        fd = open(vtname, O_RDWR);
 
342
        fd = open(vtname, O_RDWR | O_NOCTTY);
343
343
 
344
344
        for (;;) {
345
345
                struct timespec wait;
982
982
                for (deci = 0; deci < 10; deci++) {
983
983
                        needed.tv_sec = 0;
984
984
                        needed.tv_nsec = 100000000;
985
 
                        fifo_fd = open(USPLASH_OUTFIFO, O_WRONLY | O_NONBLOCK);
 
985
                        fifo_fd = open(USPLASH_OUTFIFO, O_WRONLY | O_NONBLOCK | O_NOCTTY);
986
986
                        if (fifo_fd < 0) {
987
987
                                /* protect ourselves from signals */
988
988
                                while (nanosleep(&needed,&remaining) < 0) {