forked from pool/utempter
22f221a8fc
Copy from Base:System/utempter based on submit request 41035 from user coolo OBS-URL: https://build.opensuse.org/request/show/41035 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/utempter?expand=0&rev=8
31 lines
740 B
Diff
31 lines
740 B
Diff
--- utempter-0.5.5/utempter.c
|
|
+++ utempter-0.5.5/utempter.c
|
|
@@ -89,6 +89,7 @@ int main(int argc, const char ** argv) {
|
|
int i;
|
|
struct stat sb;
|
|
char * id;
|
|
+ struct timeval tv;
|
|
|
|
if (argc < 3) usage();
|
|
|
|
@@ -116,6 +117,9 @@ int main(int argc, const char ** argv) {
|
|
host = NULL;
|
|
}
|
|
|
|
+ memset(&tv, 0, sizeof(tv));
|
|
+ (void) gettimeofday(&tv, 0);
|
|
+
|
|
memset(&utx, 0, sizeof(utx));
|
|
if (add)
|
|
utx.ut_type = USER_PROCESS;
|
|
@@ -152,7 +156,8 @@ int main(int argc, const char ** argv) {
|
|
|
|
strncpy(utx.ut_id, id, sizeof(utx.ut_id));
|
|
|
|
- gettimeofday(&utx.ut_tv, NULL);
|
|
+ utx.ut_tv.tv_sec = tv.tv_sec;
|
|
+ utx.ut_tv.tv_usec = tv.tv_usec;
|
|
|
|
pututxline(&utx);
|
|
updwtmpx(_PATH_WTMP, &utx);
|