Mir

Merge lp:~mlankhorst/mir/setsid into lp:~mir-team/mir/trunk

Proposed by Maarten Lankhorst on 2013-07-24
Status: Merged
Approved by: Thomas Voß on 2013-07-24
Approved revision: no longer in the source branch.
Merged at revision: 882
Proposed branch: lp:~mlankhorst/mir/setsid
Merge into: lp:~mir-team/mir/trunk
Diff against target: 30 lines (+20/-0)
1 file modified
src/server/graphics/gbm/linux_virtual_terminal.cpp (+20/-0)
To merge this branch: bzr merge lp:~mlankhorst/mir/setsid
Reviewer Review Type Date Requested Status
Alexandros Frantzis (community) Approve on 2013-07-24
PS Jenkins bot (community) continuous-integration Approve on 2013-07-24
Thomas Voß (community) 2013-07-24 Approve on 2013-07-24
Review via email: mp+176676@code.launchpad.net

Commit message

Fixes LP: #1195509

To post a comment you must log in.
Thomas Voß (thomas-voss) wrote :

LGTM.

review: Approve
Alexandros Frantzis (afrantzis) wrote :

Looks good from a functionality perspective. Some style nits:

8 + if (activate) {

opening brace on its own line

10 + BOOST_THROW_EXCEPTION(
11 + boost::enable_error_info(
12 + std::runtime_error("Failed to stop being a process group"))
13 + << boost::errinfo_errno(errno));

17 + BOOST_THROW_EXCEPTION(
18 + boost::enable_error_info(
19 + std::runtime_error("Failed to become session leader"))
20 + << boost::errinfo_errno(errno));

Multi-line statements in 'if' clauses should be placed in curly braces.

review: Needs Fixing
Alexandros Frantzis (afrantzis) wrote :

Looks good.

review: Approve
lp:~mlankhorst/mir/setsid updated on 2013-07-24
882. By Maarten Lankhorst on 2013-07-24

Fixes LP: #1195509. Fixes: https://bugs.launchpad.net/bugs/1195509.

Approved by Alexandros Frantzis, PS Jenkins bot, Thomas Voß.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/server/graphics/gbm/linux_virtual_terminal.cpp'
2--- src/server/graphics/gbm/linux_virtual_terminal.cpp 2013-07-08 10:32:48 +0000
3+++ src/server/graphics/gbm/linux_virtual_terminal.cpp 2013-07-24 13:26:27 +0000
4@@ -186,6 +186,26 @@
5
6 std::string const active_vt_path{vt_path_stream.str()};
7
8+ if (activate)
9+ {
10+ if (getpid() == getpgid(0) && setpgid(0, getpgid(getppid())) < 0)
11+ {
12+ BOOST_THROW_EXCEPTION(
13+ boost::enable_error_info(
14+ std::runtime_error("Failed to stop being a process group"))
15+ << boost::errinfo_errno(errno));
16+ }
17+
18+ /* become process group leader */
19+ if (setsid() < 0)
20+ {
21+ BOOST_THROW_EXCEPTION(
22+ boost::enable_error_info(
23+ std::runtime_error("Failed to become session leader"))
24+ << boost::errinfo_errno(errno));
25+ }
26+ }
27+
28 auto vt_fd = fops->open(active_vt_path.c_str(), O_RDONLY | O_NDELAY);
29
30 if (vt_fd < 0)

Subscribers

People subscribed via source and target branches