SHA256
1
0
forked from pool/systemd
systemd/apply-ACL-for-nvidia-device-nodes.patch
Stephan Kulow 4ccf744c9a Accepting request 211088 from Base:System
- Update insserv-generator.patch: fix crash in insserv generator
  (bnc#854314).
- Update apply-ACL-for-nvidia-device-nodes.patch with latest fixes
  for Nvidia cards (bnc#808319). (forwarded request 211000 from fcrozat)

OBS-URL: https://build.opensuse.org/request/show/211088
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=170
2013-12-19 11:51:56 +00:00

38 lines
1.3 KiB
Diff

From: Ludwig Nussel <ludwig.nussel@suse.de>
Date: Mon, 8 Apr 2013 14:51:47 +0200
Subject: apply ACL for nvidia device nodes
set ACL on nvidia devices (bnc#808319).
---
src/login/logind-acl.c | 3 +++
1 file changed, 3 insertions(+)
Index: systemd-208/src/login/logind-acl.c
===================================================================
--- systemd-208.orig/src/login/logind-acl.c
+++ systemd-208/src/login/logind-acl.c
@@ -287,6 +287,22 @@ int devnode_acl_all(struct udev *udev,
r = devnode_acl(n, flush, del, old_uid, add, new_uid);
}
+ /* only apply ACL on nvidia* if /dev/nvidiactl exists */
+ if (devnode_acl("/dev/nvidiactl", flush, del, old_uid, add, new_uid) >= 0) {
+ int i;
+ char *devname;
+
+ for (i = 0; i <= 256 ; i++) {
+ if (asprintf(&devname, "/dev/nvidia%d", i) < 0)
+ break;
+ if (devnode_acl(devname, flush, del, old_uid, add, new_uid) < 0) {
+ free(devname);
+ break;
+ }
+ free(devname);
+ }
+ }
+
finish:
udev_enumerate_unref(e);
set_free_free(nodes);