systemd/apply-ACL-for-nvidia-device-nodes.patch
Stephan Kulow 2ce609fe24 Accepting request 185496 from Base:System
- Ensure /usr/lib/systemd/system/shutdown.target.wants is created
  and owned by systemd package. (forwarded request 185494 from fcrozat)

OBS-URL: https://build.opensuse.org/request/show/185496
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=151
2013-08-02 05:26:48 +00:00

43 lines
1.4 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(+)
--- systemd-206.orig/src/login/logind-acl.c
+++ systemd-206/src/login/logind-acl.c
@@ -24,6 +24,7 @@
#include <acl/libacl.h>
#include <errno.h>
#include <string.h>
+#include <strv.h>
#include "logind-acl.h"
#include "util.h"
@@ -287,6 +288,22 @@ int devnode_acl_all(struct udev *udev,
r = devnode_acl(n, flush, del, old_uid, add, new_uid);
}
+ /* only search for nvidia* if /dev/nvidiactl exists */
+ if (!devnode_acl("/dev/nvidiactl", flush, del, old_uid, add, new_uid)) {
+ char** directory;
+ char **f, *resolved;
+
+ if (get_files_in_directory ("/dev", &directory)) {
+ STRV_FOREACH(f,directory)
+ if (startswith(*f,"nvidia")) {
+ resolved = strjoin("/dev/", *f, NULL);
+ devnode_acl(resolved, flush, del, old_uid, add, new_uid);
+ free(resolved);
+ }
+ }
+ strv_free(directory);
+ }
+
finish:
udev_enumerate_unref(e);
set_free_free(nodes);