Skip to content
Open
Changes from all commits
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
2 changes: 1 addition & 1 deletion Sources/Curassow/Worker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class WorkerTemp {
#if os(Linux)
let filename = Data(capacity: Int(PATH_MAX))
let pointer = filename.bytes.bindMemory(to: CChar.self, capacity: filename.capacity)
let size = readlink("/proc/self/fd/\(descriptor)", pointer, filename.capacity)
let _ = readlink("/proc/self/fd/\(descriptor)", pointer, filename.capacity)
Copy link
Member

Choose a reason for hiding this comment

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

Would probably make sense to check if the operation succeeded instead of silently handling the error.

What about changing this to something like:

let size = readlink("/proc/self/fd/\(descriptor)", pointer, filename.capacity)
if size == -1 {
  fatalError("readLink failed, errno: \(errno)")
}

Copy link
Author

Choose a reason for hiding this comment

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

That's better. But fatalError? Do you think it's OK here?

#else
let filename = Data(capacity: Int(MAXPATHLEN))
if fcntl(descriptor, F_GETPATH, filename.bytes) == -1 {
Expand Down