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

Implement gethostname() #37

merged 2 commits into from Jul 8, 2017


None yet
2 participants

ids1024 commented Jul 8, 2017

No description provided.

let fd = syscall::open("/etc/hostname", syscall::O_RDONLY)?;
let len = syscall::read(fd, &mut slice[..namelen-1])?;
slice[len] = b'\0';

This comment has been minimized.


jackpot51 Jul 8, 2017


You should close if the read fails

This comment has been minimized.


ids1024 Jul 8, 2017


Done. I took the time to implement it The Right Way (TM).


This comment has been minimized.


jackpot51 commented Jul 8, 2017

Now that is badass!

@jackpot51 jackpot51 merged commit 968da83 into redox-os:redox Jul 8, 2017

@ids1024 ids1024 deleted the ids1024:gethostname branch Jul 8, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment