diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2017-04-17 11:05:23 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2017-05-15 19:09:20 -0400 |
commit | 0b296562d46fe6a8af0ad50df08d3000f89867e1 (patch) | |
tree | cc71fa7bf49e830bec823a1a002a65aff44bae06 /sd_login/logind_session.go | |
parent | e750d7fab32b0c48b606f296d2fef5ffc618baf3 (diff) |
sd_login: Write notes on cgroup structure; realize how to simplify the code.
I'm not sure that the most appropriate error is returned in all cases.
Diffstat (limited to 'sd_login/logind_session.go')
-rw-r--r-- | sd_login/logind_session.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sd_login/logind_session.go b/sd_login/logind_session.go index 5c2c5ca..c48d619 100644 --- a/sd_login/logind_session.go +++ b/sd_login/logind_session.go @@ -14,9 +14,22 @@ package sd_login +import ( + "strings" +) + // A SessionName represents a login session. type SessionName string +func (name SessionName) isValid() bool { + id := string(name) + if id == "" { + return false + } + + return strings.TrimLeft(id, letters+digits) == "" +} + type SessionState int const ( |