chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
main: corrected do_switch_root()
[elogind.git]
/
src
/
shared
/
util.c
diff --git
a/src/shared/util.c
b/src/shared/util.c
index ae0ce320ad40b5bb0ac4cab909096a27bc7d315f..53185403d62d8e762682d1f7b499e04904fd15c1 100644
(file)
--- a/
src/shared/util.c
+++ b/
src/shared/util.c
@@
-2949,12
+2949,20
@@
char* gethostname_malloc(void) {
assert_se(uname(&u) >= 0);
assert_se(uname(&u) >= 0);
- if (
u.nodename[0]
)
+ if (
!isempty(u.nodename) && !streq(u.nodename, "(none)")
)
return strdup(u.nodename);
return strdup(u.sysname);
}
return strdup(u.nodename);
return strdup(u.sysname);
}
+bool hostname_is_set(void) {
+ struct utsname u;
+
+ assert_se(uname(&u) >= 0);
+
+ return !isempty(u.nodename) && !streq(u.nodename, "(none)");
+}
+
char* getlogname_malloc(void) {
uid_t uid;
long bufsize;
char* getlogname_malloc(void) {
uid_t uid;
long bufsize;
@@
-3131,7
+3139,7
@@
int get_ctty(pid_t pid, dev_t *_devnr, char **r) {
return 0;
}
return 0;
}
-
static
int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) {
+int rm_rf_children(int fd, bool only_dirs, bool honour_sticky) {
DIR *d;
int ret = 0;
DIR *d;
int ret = 0;