projects
/
platform
/
upstream
/
connman.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
57fd27c
)
Add support for setting default hostname
author
Marcel Holtmann
<marcel@holtmann.org>
Thu, 23 Apr 2009 11:10:51 +0000
(12:10 +0100)
committer
Marcel Holtmann
<marcel@holtmann.org>
Thu, 23 Apr 2009 11:10:51 +0000
(12:10 +0100)
plugins/loopback.c
patch
|
blob
|
history
diff --git
a/plugins/loopback.c
b/plugins/loopback.c
index 72258120be1f3437bf9baaf362a3ed5141276825..782853efe44b5b2ce37ff2206c51baf2cce2cf8d 100644
(file)
--- a/
plugins/loopback.c
+++ b/
plugins/loopback.c
@@
-136,6
+136,14
@@
static void remove_watch(void)
}
#endif
+static void create_hostname(void)
+{
+ const char *name = "localhost";
+
+ if (sethostname(name, strlen(name)) < 0)
+ connman_error("Failed to set hostname to %s", name);
+}
+
static int setup_hostname(void)
{
char name[HOST_NAME_MAX + 1];
@@
-149,6
+157,8
@@
static int setup_hostname(void)
if (strlen(name) > 0 && strcmp(name, "(none)") != 0)
connman_info("System hostname is %s", name);
+ else
+ create_hostname();
memset(name, 0, sizeof(name));