… | |
… | |
10 | * Copyright (c) 1996 Chuck Blake <cblake@BBN.COM> |
10 | * Copyright (c) 1996 Chuck Blake <cblake@BBN.COM> |
11 | * Copyright (c) 1997 mj olesen <olesen@me.queensu.ca> |
11 | * Copyright (c) 1997 mj olesen <olesen@me.queensu.ca> |
12 | * Copyright (c) 1997,1998 Oezguer Kesim <kesim@math.fu-berlin.de> |
12 | * Copyright (c) 1997,1998 Oezguer Kesim <kesim@math.fu-berlin.de> |
13 | * Copyright (c) 1998-2001 Geoff Wing <gcw@pobox.com> |
13 | * Copyright (c) 1998-2001 Geoff Wing <gcw@pobox.com> |
14 | * - extensive modifications |
14 | * - extensive modifications |
15 | * Copyright (c) 2003-2007 Marc Lehmann <pcg@goof.com> |
15 | * Copyright (c) 2003-2008 Marc Lehmann <pcg@goof.com> |
16 | * |
16 | * |
17 | * This program is free software; you can redistribute it and/or modify |
17 | * This program is free software; you can redistribute it and/or modify |
18 | * it under the terms of the GNU General Public License as published by |
18 | * it under the terms of the GNU General Public License as published by |
19 | * the Free Software Foundation; either version 2 of the License, or |
19 | * the Free Software Foundation; either version 2 of the License, or |
20 | * (at your option) any later version. |
20 | * (at your option) any later version. |
… | |
… | |
315 | static void |
315 | static void |
316 | init_secondary () |
316 | init_secondary () |
317 | { |
317 | { |
318 | int i; |
318 | int i; |
319 | |
319 | |
320 | /* |
|
|
321 | * Close all unused file descriptors |
|
|
322 | * We don't want them, we don't need them. |
|
|
323 | */ |
|
|
324 | if ((i = open ("/dev/null", O_RDONLY)) < 0) |
320 | if ((i = open ("/dev/null", O_RDONLY)) < 0) |
325 | { |
321 | { |
326 | /* TODO: BOO HISS */ |
|
|
327 | dup2 (STDERR_FILENO, STDIN_FILENO); |
322 | dup2 (STDERR_FILENO, STDIN_FILENO); |
328 | } |
323 | } |
329 | else if (i != STDIN_FILENO) |
324 | else if (i != STDIN_FILENO) |
330 | { |
325 | { |
331 | dup2 (i, STDIN_FILENO); |
326 | dup2 (i, STDIN_FILENO); |
332 | close (i); |
327 | close (i); |
333 | } |
328 | } |
334 | |
329 | |
335 | dup2 (STDERR_FILENO, STDOUT_FILENO); |
330 | dup2 (STDERR_FILENO, STDOUT_FILENO); |
336 | |
|
|
337 | #if 0 // schmorp sayz closing filies is murder |
|
|
338 | for (i = STDERR_FILENO + 1; i < num_fds; i++) |
|
|
339 | { |
|
|
340 | #ifdef __sgi /* Alex Coventry says we need 4 & 7 too */ |
|
|
341 | if (i == 4 || i == 7) |
|
|
342 | continue; |
|
|
343 | #endif |
|
|
344 | close (i); |
|
|
345 | } |
|
|
346 | #endif |
|
|
347 | } |
331 | } |
348 | |
332 | |
349 | /*----------------------------------------------------------------------*/ |
333 | /*----------------------------------------------------------------------*/ |
350 | const char ** |
334 | const char ** |
351 | rxvt_term::init_resources (int argc, const char *const *argv) |
335 | rxvt_term::init_resources (int argc, const char *const *argv) |