projects
/
connman
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add hex-encoded character string getter to AtChat
[connman]
/
plugins
/
loopback.c
diff --git
a/plugins/loopback.c
b/plugins/loopback.c
index
7225812
..
782853e
100644
(file)
--- a/
plugins/loopback.c
+++ b/
plugins/loopback.c
@@
-136,6
+136,14
@@
static void remove_watch(void)
}
#endif
}
#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];
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);
if (strlen(name) > 0 && strcmp(name, "(none)") != 0)
connman_info("System hostname is %s", name);
+ else
+ create_hostname();
memset(name, 0, sizeof(name));
memset(name, 0, sizeof(name));