[gnome-shell] util: Restore the NOFILE limit before spawning apps



commit 3fc7357e3fc65dfb33a327cee3f77a30ebae72f0
Author: Olivier Fourdan <ofourdan redhat com>
Date:   Wed Jan 19 10:15:51 2022 +0100

    util: Restore the NOFILE limit before spawning apps
    
    Make sure the restore the original NOFILE limit prior to run the
    commands so those don't inherit from the raised value.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2117>

 js/misc/util.js | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/js/misc/util.js b/js/misc/util.js
index da768566a4..bea2cfe852 100644
--- a/js/misc/util.js
+++ b/js/misc/util.js
@@ -111,9 +111,16 @@ function spawnApp(argv) {
 function trySpawn(argv) {
     var success_, pid;
     try {
-        [success_, pid] = GLib.spawn_async(null, argv, null,
-                                           GLib.SpawnFlags.SEARCH_PATH | GLib.SpawnFlags.DO_NOT_REAP_CHILD,
-                                           null);
+        [success_, pid] = GLib.spawn_async(
+            null, argv, null,
+            GLib.SpawnFlags.SEARCH_PATH | GLib.SpawnFlags.DO_NOT_REAP_CHILD,
+            () => {
+                try {
+                    global.context.restore_rlimit_nofile();
+                } catch (err) {
+                }
+            }
+        );
     } catch (err) {
         /* Rewrite the error in case of ENOENT */
         if (err.matches(GLib.SpawnError, GLib.SpawnError.NOENT)) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]