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

Conversation

valeriyvan
Copy link

No description provided.

@@ -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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants