mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-31 17:31:11 +02:00
Hostname, #271. rcS needs hostname -F /etc/hostname before ifup
git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@487 e54a6e83-5905-42d5-8d5c-058d10e6a962
Origin commit data
------------------
Commit: 4049d9a584
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2010-03-16 (Tue, 16 Mar 2010)
This commit is contained in:
@@ -205,9 +205,16 @@ char *netGetHostname( void )
|
||||
|
||||
void netSetHostname( char *host )
|
||||
{
|
||||
FILE * fp;
|
||||
|
||||
strcpy(hostbuf,host);
|
||||
hostis=1;
|
||||
sethostname(hostbuf,strlen(hostbuf)+1);
|
||||
fp = fopen("/etc/hostname", "w");
|
||||
if(fp != NULL) {
|
||||
fprintf(fp, "%s\n", hostbuf);
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
|
||||
void netSetNameserver(const char * const ip)
|
||||
|
@@ -368,6 +368,9 @@ bool setStaticAttributes(const std::string name, const bool automatic_start, con
|
||||
bool setDhcpAttributes(const std::string name, const bool automatic_start)
|
||||
{
|
||||
std::map<std::string, std::string> attribute;
|
||||
char hostname[100];
|
||||
if(gethostname(hostname, sizeof(hostname)) == 0)
|
||||
attribute["hostname"] = hostname;
|
||||
|
||||
return write_interface("/etc/network/interfaces", name, automatic_start, "inet", "dhcp", attribute);
|
||||
}
|
||||
|
Reference in New Issue
Block a user