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

Implement gethostname() #37

Merged
merged 2 commits into from Jul 8, 2017
Merged

Implement gethostname() #37

merged 2 commits into from Jul 8, 2017

Conversation

@ids1024
Copy link
Member

@ids1024 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';
syscall::close(fd)?;

This comment has been minimized.

@jackpot51

jackpot51 Jul 8, 2017
Member

You should close if the read fails

This comment has been minimized.

@ids1024

ids1024 Jul 8, 2017
Author Member

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

@jackpot51
Copy link
Member

@jackpot51 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
Labels
None yet
Projects
None yet
2 participants