packages feed

esotericbot-0.0.1: Esotericbot/Chroot.hs

{-# LANGUAGE ForeignFunctionInterface #-}
{-# INCLUDE <unistd.h> #-}
module Esotericbot.Chroot where

import Foreign.C
import Foreign

foreign import ccall unsafe "chroot" c_chroot :: CString -> IO CInt

chroot s = do
   cs <- newCString s
   i <- c_chroot cs
   if i < 0
      then error $ "Chroot to " ++ s ++ " failed!"
      else return ( )
   free cs