]> git.donarmstrong.com Git - deb_pkgs/autorandr.git/commitdiff
batch mode: Skip all uid < 1000 programs instead of only uid = 0
authorPhillip Berndt <phillip.berndt@googlemail.com>
Wed, 23 Nov 2016 20:25:09 +0000 (21:25 +0100)
committerPhillip Berndt <phillip.berndt@googlemail.com>
Wed, 23 Nov 2016 20:25:09 +0000 (21:25 +0100)
This fixes bug #63, but might have unexpected side effects. From a
comment in the commit:

> The following line assumes that user accounts start at 1000 and that
> no one works using the root or another system account. This is rather
> restrictive, but de facto default.  Alternatives would be to use the
> UID_MIN from /etc/login.defs or FIRST_UID from /etc/adduser.conf; but
> effectively, both values aren't binding in any way.  If this breaks
> your use case, please file a bug on Github.

autorandr.py

index 84fb3b356e86aee9d00ab601f1b381461a9c0df5..af1c8c3becda2fd7c7c67bd2f93b042ffb54816c 100755 (executable)
@@ -798,7 +798,14 @@ def dispatch_call_to_sessions(argv):
         if not os.path.isfile(environ_file):
             continue
         uid = os.stat(environ_file).st_uid
-        if uid == 0:
+
+        # The following line assumes that user accounts start at 1000 and that
+        # no one works using the root or another system account. This is rather
+        # restrictive, but de facto default. Alternatives would be to use the
+        # UID_MIN from /etc/login.defs or FIRST_UID from /etc/adduser.conf;
+        # but effectively, both values aren't binding in any way.
+        # If this breaks your use case, please file a bug on Github.
+        if uid < 1000:
             continue
 
         process_environ = {}