summaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
author"Vladimir N. Oleynik"2006-02-20 10:44:02 +0000
committer"Vladimir N. Oleynik"2006-02-20 10:44:02 +0000
commitd24d0830616dc6c040caec3466786b6d7120b7b9 (patch)
tree0bec7d7290363dc3bcfbf673cafc23e19ec31ee7 /libbb
parent4e9deec8bf465552ff621a80421721b702051747 (diff)
downloadbusybox-d24d0830616dc6c040caec3466786b6d7120b7b9.zip
busybox-d24d0830616dc6c040caec3466786b6d7120b7b9.tar.gz
correction get(host/domain)name usage, revert 742 bug
Diffstat (limited to 'libbb')
-rw-r--r--libbb/login.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libbb/login.c b/libbb/login.c
index 2d61625..98799dc 100644
--- a/libbb/login.c
+++ b/libbb/login.c
@@ -37,7 +37,7 @@ void print_login_issue(const char *issue_file, const char *tty)
{
FILE *fd;
int c;
- char buf[256];
+ char buf[256+2];
const char *outbuf;
time_t t;
struct utsname uts;
@@ -82,8 +82,8 @@ void print_login_issue(const char *issue_file, const char *tty)
case 'D':
case 'o':
- getdomainname(buf, sizeof(buf));
- buf[sizeof(buf) - 1] = '\0';
+ buf[0] = '\0';
+ getdomainname(buf, sizeof(buf) - 1);
break;
case 'd':
@@ -95,8 +95,8 @@ void print_login_issue(const char *issue_file, const char *tty)
break;
case 'h':
+ buf[0] = '\0';
gethostname(buf, sizeof(buf) - 1);
- buf[sizeof(buf) - 1] = '\0';
break;
case 'l':
@@ -120,8 +120,8 @@ void print_login_prompt(void)
{
char buf[MAXHOSTNAMELEN+1];
- gethostname(buf, MAXHOSTNAMELEN);
- fputs(buf, stdout);
+ if(gethostname(buf, MAXHOSTNAMELEN) == 0)
+ fputs(buf, stdout);
fputs(LOGIN, stdout);
fflush(stdout);