~robert-ancell/lightdm/xorg-displayfd

« back to all changes in this revision

Viewing changes to src/session-child.c

  • Committer: Robert Ancell
  • Date: 2012-03-05 00:23:32 UTC
  • Revision ID: robert.ancell@canonical.com-20120305002332-eox30d8k6gb70qrc
Stop file descriptors leaking into the session processes

Show diffs side-by-side

added added

removed removed

Lines of Context:
170
170
    GDBusConnection *bus;
171
171
    gchar *console_kit_cookie;
172
172
    GError *error = NULL;
173
 
  
 
173
 
174
174
    g_type_init ();
175
175
 
176
176
    /* Make input non-blocking */
193
193
    to_daemon_input = atoi (argv[3]);
194
194
    if (from_daemon_output == 0 || to_daemon_input == 0)
195
195
    {
196
 
        g_printerr ("Invalid LIGHTDM_DAEMON_PIPE\n");
 
196
        g_printerr ("Invalid file descriptors %s %s\n", argv[2], argv[3]);
197
197
        return EXIT_FAILURE;
198
198
    }
199
 
    g_unsetenv ("LIGHTDM_DAEMON_PIPE");
 
199
 
 
200
    /* Don't let these pipes leak to the command we will run */
 
201
    fcntl (from_daemon_output, F_SETFD, FD_CLOEXEC);
 
202
    fcntl (to_daemon_input, F_SETFD, FD_CLOEXEC);
200
203
 
201
204
    /* Read a version number so we can handle upgrades (i.e. a newer version of session child is run for an old daemon */
202
205
    read_data (&version, sizeof (version));