summaryrefslogtreecommitdiff
path: root/Presence/LocalPeerCred.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2013-07-05 17:36:05 -0400
committerjoe <joe@jerkface.net>2013-07-05 17:36:05 -0400
commitf183eca9bc5b531f32ec9302e7c9a538a88beb9c (patch)
tree1fda17b39f933679f78b4086337fffc5ef409c34 /Presence/LocalPeerCred.hs
parent14c347717c79adf3450715365562e51e3532d8cb (diff)
Now assigns tty for resource id.
Diffstat (limited to 'Presence/LocalPeerCred.hs')
-rw-r--r--Presence/LocalPeerCred.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/Presence/LocalPeerCred.hs b/Presence/LocalPeerCred.hs
index 2d5c0628..14f5234a 100644
--- a/Presence/LocalPeerCred.hs
+++ b/Presence/LocalPeerCred.hs
@@ -107,15 +107,17 @@ unmap6mapped4 addr = addr
107identifyTTY tty_pids uid inode = do 107identifyTTY tty_pids uid inode = do
108 pid <- scanProc (show uid) (L.unpack inode) 108 pid <- scanProc (show uid) (L.unpack inode)
109 -- putStrLn $ "scanProc --> "++show pid 109 -- putStrLn $ "scanProc --> "++show pid
110 flip (maybe (return Nothing)) pid $ \(pid,ttydev) -> do 110 flip (maybe (return (Nothing,Nothing))) pid $ \(pid,ttydev) -> do
111 tty <- ttyOrDisplay pid ttydev 111 tty <- ttyOrDisplay pid ttydev
112 -- putStrLn $ "users = " ++ show tty_pids 112 -- putStrLn $ "users = " ++ show tty_pids
113 dts <- ttyToXorgs tty_pids 113 dts <- ttyToXorgs tty_pids
114 -- putStrLn $ "displays = " ++ show dts 114 -- putStrLn $ "displays = " ++ show dts
115 -- putStrLn $ "tty = " ++ show tty 115 -- putStrLn $ "tty = " ++ show tty
116 -- -- displays = [(":5",Chunk "tty7" Empty)] 116 -- -- displays = [(":5",Chunk "tty7" Empty)]
117 let tty' = if take 3 tty=="tty" then Just (L.pack tty) else lookup (parseTty tty) (map (first parseTty) dts) 117 let tty' = if take 3 tty=="tty"
118 return tty' 118 then Just (L.pack tty)
119 else lookup (parseTty tty) (map (first parseTty) dts)
120 return (tty',Just pid)
119 where 121 where
120 parseTty :: String -> Float 122 parseTty :: String -> Float
121 parseTty = read . tail . dropWhile (/=':') 123 parseTty = read . tail . dropWhile (/=':')