diff options
Diffstat (limited to 'miscutils/devfsd.c')
-rw-r--r-- | miscutils/devfsd.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c index 52a65bc98..286f00fd8 100644 --- a/miscutils/devfsd.c +++ b/miscutils/devfsd.c | |||
@@ -1133,8 +1133,8 @@ static void signal_handler(int sig) | |||
1133 | static const char *get_variable(const char *variable, void *info) | 1133 | static const char *get_variable(const char *variable, void *info) |
1134 | { | 1134 | { |
1135 | static char sbuf[sizeof(int)*3 + 2]; /* sign and NUL */ | 1135 | static char sbuf[sizeof(int)*3 + 2]; /* sign and NUL */ |
1136 | static char *hostname; | ||
1136 | 1137 | ||
1137 | char hostname[STRING_LENGTH]; | ||
1138 | struct get_variable_info *gv_info = info; | 1138 | struct get_variable_info *gv_info = info; |
1139 | const char *field_names[] = { | 1139 | const char *field_names[] = { |
1140 | "hostname", "mntpt", "devpath", "devname", | 1140 | "hostname", "mntpt", "devpath", "devname", |
@@ -1143,12 +1143,8 @@ static const char *get_variable(const char *variable, void *info) | |||
1143 | }; | 1143 | }; |
1144 | int i; | 1144 | int i; |
1145 | 1145 | ||
1146 | if (gethostname(hostname, STRING_LENGTH - 1) != 0) | 1146 | if (!hostname) |
1147 | /* Here on error we should do exit(RV_SYS_ERROR), instead we do exit(EXIT_FAILURE) */ | 1147 | hostname = safe_gethostname(); |
1148 | error_logger_and_die(LOG_ERR, "gethostname"); | ||
1149 | |||
1150 | hostname[STRING_LENGTH - 1] = '\0'; | ||
1151 | |||
1152 | /* index_in_str_array returns i>=0 */ | 1148 | /* index_in_str_array returns i>=0 */ |
1153 | i = index_in_str_array(field_names, variable); | 1149 | i = index_in_str_array(field_names, variable); |
1154 | 1150 | ||