Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: ls throws IOError on empty directories #1

Merged
merged 2 commits into from
Aug 7, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/System/HDFS.hs
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,15 @@ ls :: FileSystem -> Path -> IO [FileInfo]
ls (FileSystem fs) p =
withCString p $ \path ->
alloca $ \numptr -> do
cinfo <- throwErrnoIfNull "ls" $
cinfo <- --throwErrnoIfNull "ls" $
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind just removing the commented code?

c_hdfs_list_directory fs path numptr
num <- peek numptr
info <- peekArray (fromIntegral num) cinfo >>= mapM mkFileInfo
c_hdfs_free_file_info cinfo num
return info
errNo <- getErrno
if errNo == eOK
then return info
else throwErrno "ls"

cwd :: FileSystem -> IO String
cwd (FileSystem fs) =
Expand Down