avoid head
This commit is contained in:
		
					parent
					
						
							
								0833eb43a6
							
						
					
				
			
			
				commit
				
					
						ac71ab7bd7
					
				
			
		
					 2 changed files with 7 additions and 5 deletions
				
			
		| 
						 | 
					@ -98,11 +98,11 @@ checkMountMonitor :: Client -> IO Bool
 | 
				
			||||||
checkMountMonitor client = do
 | 
					checkMountMonitor client = do
 | 
				
			||||||
	running <- filter (`elem` usableservices)
 | 
						running <- filter (`elem` usableservices)
 | 
				
			||||||
		<$> listServiceNames client
 | 
							<$> listServiceNames client
 | 
				
			||||||
	if null running
 | 
						case running of
 | 
				
			||||||
		then startOneService client startableservices
 | 
							[] -> startOneService client startableservices
 | 
				
			||||||
		else do
 | 
							(service:_) -> do
 | 
				
			||||||
			debug thisThread [ "Using running DBUS service"
 | 
								debug thisThread [ "Using running DBUS service"
 | 
				
			||||||
				, Prelude.head running
 | 
									, service
 | 
				
			||||||
				, "to monitor mount events."
 | 
									, "to monitor mount events."
 | 
				
			||||||
				]
 | 
									]
 | 
				
			||||||
			return True
 | 
								return True
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -67,7 +67,9 @@ runWebApp app observer = do
 | 
				
			||||||
localSocket :: IO Socket
 | 
					localSocket :: IO Socket
 | 
				
			||||||
localSocket = do
 | 
					localSocket = do
 | 
				
			||||||
	addrs <- getAddrInfo (Just hints) (Just localhost) Nothing
 | 
						addrs <- getAddrInfo (Just hints) (Just localhost) Nothing
 | 
				
			||||||
	go $ Prelude.head addrs
 | 
						case addrs of
 | 
				
			||||||
 | 
							[] -> error "unable to bind to a local socket"
 | 
				
			||||||
 | 
							(addr:_) -> go addr
 | 
				
			||||||
	where
 | 
						where
 | 
				
			||||||
		hints = defaultHints
 | 
							hints = defaultHints
 | 
				
			||||||
			{ addrFlags = [AI_ADDRCONFIG]
 | 
								{ addrFlags = [AI_ADDRCONFIG]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue