Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
U
unix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Rinat Striungis
unix
Commits
b2a695f3
Commit
b2a695f3
authored
13 years ago
by
dterei
Browse files
Options
Downloads
Patches
Plain Diff
Use error not ioError for consistency.
parent
4b867e26
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
System/Posix/Temp.hsc
+2
-5
2 additions, 5 deletions
System/Posix/Temp.hsc
System/Posix/Temp/ByteString.hsc
+2
-5
2 additions, 5 deletions
System/Posix/Temp/ByteString.hsc
with
4 additions
and
10 deletions
System/Posix/Temp.hsc
+
2
−
5
View file @
b2a695f3
...
...
@@ -23,9 +23,6 @@ module System.Posix.Temp (
#include "HsUnix.h"
#if !HAVE_MKSTEMPS
import Control.Exception (throwIO)
#endif
import Foreign.C
import System.IO
#if !HAVE_MKDTEMP
...
...
@@ -93,8 +90,8 @@ foreign import ccall unsafe "HsUnix.h __hscore_mkstemps"
-- If you are using as system that doesn't support the mkstemps glibc function
-- (supported in glibc > 2.11) then this function simply throws an error.
mkstemps :: String -> String -> IO (FilePath, Handle)
mkstemps prefix suffix = do
#if HAVE_MKSTEMPS
mkstemps prefix suffix = do
let template = prefix ++ "XXXXXX" ++ suffix
lenOfsuf = (fromIntegral $ length suffix) :: CInt
withFilePath template $ \ ptr -> do
...
...
@@ -103,7 +100,7 @@ mkstemps prefix suffix = do
h <- fdToHandle (Fd fd)
return (name, h)
#else
throwIO . userError $ "mkstemps: System does
not
h
av
e a mkstemp C function.
"
mkstemps = error "System.Posix.Temp.mkstemps:
not av
ailable on this platform
"
#endif
#if HAVE_MKDTEMP
...
...
This diff is collapsed.
Click to expand it.
System/Posix/Temp/ByteString.hsc
+
2
−
5
View file @
b2a695f3
...
...
@@ -23,9 +23,6 @@ module System.Posix.Temp.ByteString (
#include "HsUnix.h"
#if !HAVE_MKSTEMPS
import Control.Exception (throwIO)
#endif
import Data.ByteString (ByteString)
import qualified Data.ByteString as B
import qualified Data.ByteString.Char8 as BC
...
...
@@ -78,8 +75,8 @@ foreign import ccall unsafe "HsUnix.h __hscore_mkstemps"
-- the created file, which contains 6 random characters in between
-- the prefix and suffix.
mkstemps :: ByteString -> ByteString -> IO (RawFilePath, Handle)
mkstemps prefix suffix = do
#if HAVE_MKSTEMPS
mkstemps prefix suffix = do
let template = prefix `B.append` (BC.pack "XXXXXX") `B.append` suffix
lenOfsuf = (fromIntegral $ B.length suffix) :: CInt
withFilePath template $ \ ptr -> do
...
...
@@ -88,7 +85,7 @@ mkstemps prefix suffix = do
h <- fdToHandle (Fd fd)
return (name, h)
#else
throwIO . userError $ "mkstemps: System does
not
h
av
e a mkstemp C function.
"
mkstemps = error "System.Posix.Temp.mkstemps:
not av
ailable on this platform
"
#endif
#if HAVE_MKDTEMP
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment