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 #1768: Handle segfault when current directory was unlinked #1842

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -15,6 +15,7 @@ import java.nio.file.spi.FileSystemProvider
import java.net.URI
import java.util.concurrent.ExecutorService
import java.util.{Map, Set}
import scala.scalanative.libc.errno

class UnixFileSystemProvider extends FileSystemProvider {

Expand Down Expand Up @@ -137,7 +138,9 @@ class UnixFileSystemProvider extends FileSystemProvider {

private def getUserDir(): String = {
val buff = stackalloc[CChar](4096)
val res = unistd.getcwd(buff, 4095)
val res = unistd.getcwd(buff, 4095)
if (res == null)
throw UnixException("Could not determine current working directory", errno.errno)
fromCString(res)
}

Expand Down