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

Never used const size replaced for _ to supress compiler warning #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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