1
0
This commit is contained in:
Daniel Tartavel 2020-05-07 19:25:37 +02:00
parent d7c386cc9b
commit ce35181bc6

11
main.c
View File

@ -110,15 +110,12 @@ int getprocinfo( int ppid, char cmdline[], char cmd[], char user[], char host_ip
time_t timet=0; time_t timet=0;
getutmp( pid, user, host_ip, &timet ); getutmp( pid, user, host_ip, &timet );
if ( timet != 0) if ( timet == 0)
{
sprintf(date, "%s", ctime(&timet));
}else
{ {
time( &timet ); time( &timet );
sprintf( date, "%s", ctime(&timet) );
date[strlen(date)-1] = 0;
} }
sprintf( date, "%s", ctime(&timet) );
date[strlen(date)-1] = 0;
while ( flag == 0) while ( flag == 0)
{ {
r = getpids( pid, child_pid ); r = getpids( pid, child_pid );
@ -289,7 +286,7 @@ int main()
perror(logfile); perror(logfile);
return 7; return 7;
} }
fprintf(fh1, "%s: %s Connecté depuis %s - %s %s\n", date, host_ip, user, cmd, cmdline); fprintf(fh1, "%s: %s Connecté depuis %s - %s %s\n", date, user, host_ip, cmd, cmdline);
fclose(fh1); fclose(fh1);
} }
} }