diff --git a/main.c b/main.c index 8c7c99c..6fe48ac 100644 --- a/main.c +++ b/main.c @@ -42,16 +42,16 @@ void getutmp( int pid, char user[], char host_ip[], char host_ipv6[], time_t * t if((utmp->ut_addr_v6[1] && utmp->ut_addr_v6[2] && utmp->ut_addr_v6[3]) == 0) { ipv4 = utmp->ut_addr_v6[0] & 0x00000000000000ff; - sprintf( str, "%x.", ipv4); + sprintf( str, "%d.", ipv4); strcat(host_ip, str); ipv4 = (utmp->ut_addr_v6[0] & 0x000000000000ff00) >> 8; - sprintf( str, "%x.", ipv4); + sprintf( str, "%d.", ipv4); strcat(host_ip, str); ipv4 = (utmp->ut_addr_v6[0] & 0x0000000000ff0000) >> 16; - sprintf( str, "%x.", ipv4); + sprintf( str, "%d.", ipv4); strcat(host_ip, str); ipv4 = (utmp->ut_addr_v6[0] & 0x00000000ff000000) >> 24; - sprintf( str, "%x", ipv4); + sprintf( str, "%d", ipv4); strcat(host_ip, str); }else @@ -226,8 +226,8 @@ int main() char cmd[24]; char cmdline[1000]; char user[24]=""; - char host_ip[42]; - char host_ipv6[42]; + char host_ip[42]=""; + char host_ipv6[42]=""; char str[1024]; char date[60]; time_t now ;