diff options
-rw-r--r-- | libbb/login.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/libbb/login.c b/libbb/login.c index 346ff13eb..1703a2eb7 100644 --- a/libbb/login.c +++ b/libbb/login.c | |||
@@ -20,7 +20,7 @@ static const char fmtstr_t[] ALIGN1 = "%H:%M:%S"; | |||
20 | 20 | ||
21 | void FAST_FUNC print_login_issue(const char *issue_file, const char *tty) | 21 | void FAST_FUNC print_login_issue(const char *issue_file, const char *tty) |
22 | { | 22 | { |
23 | FILE *fd; | 23 | FILE *fp; |
24 | int c; | 24 | int c; |
25 | char buf[256+1]; | 25 | char buf[256+1]; |
26 | const char *outbuf; | 26 | const char *outbuf; |
@@ -32,10 +32,10 @@ void FAST_FUNC print_login_issue(const char *issue_file, const char *tty) | |||
32 | 32 | ||
33 | puts("\r"); /* start a new line */ | 33 | puts("\r"); /* start a new line */ |
34 | 34 | ||
35 | fd = fopen(issue_file, "r"); | 35 | fp = fopen(issue_file, "r"); |
36 | if (!fd) | 36 | if (!fp) |
37 | return; | 37 | return; |
38 | while ((c = fgetc(fd)) != EOF) { | 38 | while ((c = fgetc(fp)) != EOF) { |
39 | outbuf = buf; | 39 | outbuf = buf; |
40 | buf[0] = c; | 40 | buf[0] = c; |
41 | buf[1] = '\0'; | 41 | buf[1] = '\0'; |
@@ -44,7 +44,7 @@ void FAST_FUNC print_login_issue(const char *issue_file, const char *tty) | |||
44 | buf[2] = '\0'; | 44 | buf[2] = '\0'; |
45 | } | 45 | } |
46 | if (c == '\\' || c == '%') { | 46 | if (c == '\\' || c == '%') { |
47 | c = fgetc(fd); | 47 | c = fgetc(fp); |
48 | switch (c) { | 48 | switch (c) { |
49 | case 's': | 49 | case 's': |
50 | outbuf = uts.sysname; | 50 | outbuf = uts.sysname; |
@@ -64,8 +64,7 @@ void FAST_FUNC print_login_issue(const char *issue_file, const char *tty) | |||
64 | break; | 64 | break; |
65 | case 'D': | 65 | case 'D': |
66 | case 'o': | 66 | case 'o': |
67 | c = getdomainname(buf, sizeof(buf) - 1); | 67 | outbuf = uts.domainname; |
68 | buf[c >= 0 ? c : 0] = '\0'; | ||
69 | break; | 68 | break; |
70 | case 'd': | 69 | case 'd': |
71 | strftime(buf, sizeof(buf), fmtstr_d, localtime(&t)); | 70 | strftime(buf, sizeof(buf), fmtstr_d, localtime(&t)); |
@@ -82,7 +81,7 @@ void FAST_FUNC print_login_issue(const char *issue_file, const char *tty) | |||
82 | } | 81 | } |
83 | fputs(outbuf, stdout); | 82 | fputs(outbuf, stdout); |
84 | } | 83 | } |
85 | fclose(fd); | 84 | fclose(fp); |
86 | fflush(stdout); | 85 | fflush(stdout); |
87 | } | 86 | } |
88 | 87 | ||