Add sethostname(2).

Not very useful, but helps building stuff like toybox out of the box.

Change-Id: I110e39030452bd093a84278e019c5752d293718d
This commit is contained in:
Elliott Hughes
2014-11-07 16:07:13 -08:00
parent 2ed9ee1e93
commit b86a4c7f65
9 changed files with 125 additions and 1 deletions

View File

@@ -470,3 +470,11 @@ class unistd_DeathTest : public BionicDeathTest {};
TEST_F(unistd_DeathTest, abort) {
ASSERT_EXIT(abort(), testing::KilledBySignal(SIGABRT), "");
}
TEST(unistd, sethostname) {
// The permissions check happens before the argument check, so this will
// fail for a different reason if you're running as root than if you're
// not, but it'll fail either way. Checking that we have the symbol is about
// all we can do for sethostname(2).
ASSERT_EQ(-1, sethostname("", -1));
}