diff options
-rw-r--r-- | miscutils/last_fancy.c | 5 | ||||
-rw-r--r-- | networking/inetd.c | 2 | ||||
-rw-r--r-- | util-linux/rdate.c | 8 | ||||
-rw-r--r-- | util-linux/rtcwake.c | 12 |
4 files changed, 14 insertions, 13 deletions
diff --git a/miscutils/last_fancy.c b/miscutils/last_fancy.c index f687d7e16..16ed9e920 100644 --- a/miscutils/last_fancy.c +++ b/miscutils/last_fancy.c | |||
@@ -42,7 +42,7 @@ enum { | |||
42 | static void show_entry(struct utmp *ut, int state, time_t dur_secs) | 42 | static void show_entry(struct utmp *ut, int state, time_t dur_secs) |
43 | { | 43 | { |
44 | unsigned days, hours, mins; | 44 | unsigned days, hours, mins; |
45 | char duration[32]; | 45 | char duration[sizeof("(%u+02:02)") + sizeof(int)*3]; |
46 | char login_time[17]; | 46 | char login_time[17]; |
47 | char logout_time[8]; | 47 | char logout_time[8]; |
48 | const char *logout_str; | 48 | const char *logout_str; |
@@ -53,7 +53,8 @@ static void show_entry(struct utmp *ut, int state, time_t dur_secs) | |||
53 | * but some systems have it wrong */ | 53 | * but some systems have it wrong */ |
54 | tmp = ut->ut_tv.tv_sec; | 54 | tmp = ut->ut_tv.tv_sec; |
55 | safe_strncpy(login_time, ctime(&tmp), 17); | 55 | safe_strncpy(login_time, ctime(&tmp), 17); |
56 | snprintf(logout_time, 8, "- %s", ctime(&dur_secs) + 11); | 56 | tmp = dur_secs; |
57 | snprintf(logout_time, 8, "- %s", ctime(&tmp) + 11); | ||
57 | 58 | ||
58 | dur_secs = MAX(dur_secs - (time_t)ut->ut_tv.tv_sec, (time_t)0); | 59 | dur_secs = MAX(dur_secs - (time_t)ut->ut_tv.tv_sec, (time_t)0); |
59 | /* unsigned int is easier to divide than time_t (which may be signed long) */ | 60 | /* unsigned int is easier to divide than time_t (which may be signed long) */ |
diff --git a/networking/inetd.c b/networking/inetd.c index 584c5e5e4..b3f2e9fbc 100644 --- a/networking/inetd.c +++ b/networking/inetd.c | |||
@@ -1654,7 +1654,7 @@ static void FAST_FUNC daytime_stream(int s, servtab_t *sep UNUSED_PARAM) | |||
1654 | { | 1654 | { |
1655 | time_t t; | 1655 | time_t t; |
1656 | 1656 | ||
1657 | t = time(NULL); | 1657 | time(&t); |
1658 | fdprintf(s, "%.24s\r\n", ctime(&t)); | 1658 | fdprintf(s, "%.24s\r\n", ctime(&t)); |
1659 | } | 1659 | } |
1660 | static void FAST_FUNC daytime_dg(int s, servtab_t *sep) | 1660 | static void FAST_FUNC daytime_dg(int s, servtab_t *sep) |
diff --git a/util-linux/rdate.c b/util-linux/rdate.c index 6e35cd519..8075ef6af 100644 --- a/util-linux/rdate.c +++ b/util-linux/rdate.c | |||
@@ -11,9 +11,9 @@ | |||
11 | //usage:#define rdate_trivial_usage | 11 | //usage:#define rdate_trivial_usage |
12 | //usage: "[-sp] HOST" | 12 | //usage: "[-sp] HOST" |
13 | //usage:#define rdate_full_usage "\n\n" | 13 | //usage:#define rdate_full_usage "\n\n" |
14 | //usage: "Get and possibly set the system date/time from a remote HOST\n" | 14 | //usage: "Get and possibly set system time from a remote HOST\n" |
15 | //usage: "\n -s Set the system date/time (default)" | 15 | //usage: "\n -s Set system time (default)" |
16 | //usage: "\n -p Print the date/time" | 16 | //usage: "\n -p Print time" |
17 | 17 | ||
18 | #include "libbb.h" | 18 | #include "libbb.h" |
19 | 19 | ||
@@ -36,7 +36,7 @@ static time_t askremotedate(const char *host) | |||
36 | fd = create_and_connect_stream_or_die(host, bb_lookup_port("time", "tcp", 37)); | 36 | fd = create_and_connect_stream_or_die(host, bb_lookup_port("time", "tcp", 37)); |
37 | 37 | ||
38 | if (safe_read(fd, &nett, 4) != 4) /* read time from server */ | 38 | if (safe_read(fd, &nett, 4) != 4) /* read time from server */ |
39 | bb_error_msg_and_die("%s did not send the complete time", host); | 39 | bb_error_msg_and_die("%s: %s", host, "short read"); |
40 | if (ENABLE_FEATURE_CLEAN_UP) | 40 | if (ENABLE_FEATURE_CLEAN_UP) |
41 | close(fd); | 41 | close(fd); |
42 | 42 | ||
diff --git a/util-linux/rtcwake.c b/util-linux/rtcwake.c index 33cdbfad4..53d9384db 100644 --- a/util-linux/rtcwake.c +++ b/util-linux/rtcwake.c | |||
@@ -32,18 +32,18 @@ | |||
32 | //usage: "\n -l,--local Clock is set to local time" | 32 | //usage: "\n -l,--local Clock is set to local time" |
33 | //usage: "\n -u,--utc Clock is set to UTC time" | 33 | //usage: "\n -u,--utc Clock is set to UTC time" |
34 | //usage: "\n -d,--device=DEV Specify the RTC device" | 34 | //usage: "\n -d,--device=DEV Specify the RTC device" |
35 | //usage: "\n -m,--mode=MODE Set the sleep state (default: standby)" | 35 | //usage: "\n -m,--mode=MODE Set sleep state (default: standby)" |
36 | //usage: "\n -s,--seconds=SEC Set the timeout in SEC seconds from now" | 36 | //usage: "\n -s,--seconds=SEC Set timeout in SEC seconds from now" |
37 | //usage: "\n -t,--time=TIME Set the timeout to TIME seconds from epoch" | 37 | //usage: "\n -t,--time=TIME Set timeout to TIME seconds from epoch" |
38 | //usage: ) | 38 | //usage: ) |
39 | //usage: IF_NOT_LONG_OPTS( | 39 | //usage: IF_NOT_LONG_OPTS( |
40 | //usage: "\n -a Read clock mode from adjtime" | 40 | //usage: "\n -a Read clock mode from adjtime" |
41 | //usage: "\n -l Clock is set to local time" | 41 | //usage: "\n -l Clock is set to local time" |
42 | //usage: "\n -u Clock is set to UTC time" | 42 | //usage: "\n -u Clock is set to UTC time" |
43 | //usage: "\n -d DEV Specify the RTC device" | 43 | //usage: "\n -d DEV Specify the RTC device" |
44 | //usage: "\n -m MODE Set the sleep state (default: standby)" | 44 | //usage: "\n -m MODE Set sleep state (default: standby)" |
45 | //usage: "\n -s SEC Set the timeout in SEC seconds from now" | 45 | //usage: "\n -s SEC Set timeout in SEC seconds from now" |
46 | //usage: "\n -t TIME Set the timeout to TIME seconds from epoch" | 46 | //usage: "\n -t TIME Set timeout to TIME seconds from epoch" |
47 | //usage: ) | 47 | //usage: ) |
48 | 48 | ||
49 | #include "libbb.h" | 49 | #include "libbb.h" |