source:
pkg/raul/main/vte/trunk/debian/patches/91_keep_fds.patch
@
7372
| Revision 7372, 2.0 KB checked in by alanbach-guest, 2 years ago (diff) |
|---|
-
src/pty.c
diff -urN vte-0.26.2/src/pty.c vte-0.26.2.new//src/pty.c
old new 192 192 const char *name; 193 193 int fd; 194 194 } tty; 195 int keep_fd; 195 196 } VtePtyChildSetupData; 196 197 197 198 /** … … 332 333 close(fd); 333 334 } 334 335 336 if (data->keep_fd > 0) { 337 int i; 338 /* Close most descriptors. */ 339 for (i = 0; i < sysconf(_SC_OPEN_MAX); i++) { 340 if (i != data->keep_fd && 341 i != fd && 342 i != STDOUT_FILENO && 343 i != STDIN_FILENO && 344 i != STDERR_FILENO) { 345 close(i); 346 } 347 } 348 } 349 335 350 /* Reset our signals -- our parent may have done any number of 336 351 * weird things to them. */ 337 352 _vte_pty_reset_signal_handlers(); … … 440 455 return (gchar **) g_ptr_array_free (array, FALSE); 441 456 } 442 457 458 static int 459 _vte_pty_keep_fd(char **env_add) 460 { 461 int i; 462 if (env_add == NULL) 463 return -1; 464 465 const gchar *needle = "VTE_PTY_KEEP_FD="; 466 for (i = 0; env_add[i] != NULL; i++) { 467 gchar *s = strstr(env_add[i], needle); 468 if (s != NULL) 469 return atoi(&s[strlen(needle)]); 470 } 471 472 return -1; 473 } 474 443 475 /* 444 476 * __vte_pty_get_pty_flags: 445 477 * @lastlog: %TRUE if the session should be logged to the lastlog … … 523 555 /* add the given environment to the childs */ 524 556 envp2 = __vte_pty_merge_environ (envv, pty->priv->term); 525 557 558 pty->priv->child_setup_data.keep_fd = _vte_pty_keep_fd(envp2); 559 if (pty->priv->child_setup_data.keep_fd > 0) 560 spawn_flags |= G_SPAWN_LEAVE_DESCRIPTORS_OPEN; 561 526 562 _VTE_DEBUG_IF (VTE_DEBUG_MISC) { 527 563 g_printerr ("Spawing command:\n"); 528 564 for (i = 0; argv[i] != NULL; i++) {
Note: See TracBrowser
for help on using the repository browser.


