summaryrefslogtreecommitdiff
path: root/libbb/login.c
diff options
context:
space:
mode:
author"Vladimir N. Oleynik"2006-02-20 16:57:36 +0000
committer"Vladimir N. Oleynik"2006-02-20 16:57:36 +0000
commit7673ccad60d4714b907a46b4b51a4e0a4fafb099 (patch)
tree7967f2ce6214b87b29bee24e361411d6a9c337ad /libbb/login.c
parent081d6d4380968dcbe90f66e31ba51ecce100998a (diff)
downloadbusybox-7673ccad60d4714b907a46b4b51a4e0a4fafb099.zip
busybox-7673ccad60d4714b907a46b4b51a4e0a4fafb099.tar.gz
sync with mainstream, but check more
Diffstat (limited to 'libbb/login.c')
-rw-r--r--libbb/login.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libbb/login.c b/libbb/login.c
index 2d61625..0abc9dc 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+1];
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';
+ c = getdomainname(buf, sizeof(buf) - 1);
+ buf[c >= 0 ? c : 0] = '\0';
break;
case 'd':
@@ -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);