Code Review
/
src
/
app-framework-main.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Update date in copyrights
[src/app-framework-main.git]
/
src
/
afm-user-session.c
diff --git
a/src/afm-user-session.c
b/src/afm-user-session.c
index
51acafe
..
1a8e33e
100644
(file)
--- a/
src/afm-user-session.c
+++ b/
src/afm-user-session.c
@@
-1,5
+1,5
@@
/*
/*
- Copyright
2018
IoT.bzh
+ Copyright
(C) 2018, 2019
IoT.bzh
author: José Bollo <jose.bollo@iot.bzh>
author: José Bollo <jose.bollo@iot.bzh>
@@
-16,23
+16,20
@@
limitations under the License.
*/
limitations under the License.
*/
-#include <signal.h>
+#include <stdio.h>
+#include <unistd.h>
#include <systemd/sd-daemon.h>
#include <systemd/sd-daemon.h>
+extern char **environ;
+
int main()
{
int main()
{
- sigset_t ass, bss;
-
- sigemptyset(&ass);
- sigaddset(&ass, SIGTERM);
-
- sigfillset(&bss);
- sigdelset(&bss, SIGTERM);
+ char buffer[100];
+ char *args[] = { "/bin/systemctl", "--wait", "start", buffer, 0 };
+ sprintf(buffer, "afm-user-session@%d.target", (int)getuid());
sd_notify(0, "READY=1");
sd_notify(0, "READY=1");
- sigprocmask(SIG_SETMASK, &bss, 0);
- sigwaitinfo(&ass, 0);
-
- return 0;
+ execve(args[0], args, environ);
+ return 1;
}
}