From: Alejandro Colomar Date: Wed, 6 Sep 2023 23:23:11 +0000 (+0200) Subject: getutent.3: EXAMPLES: Fix use of time(3) X-Git-Tag: man-pages-6.06~270 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=794840df8cf47d3d2cd31389c93e5d2530739301;p=thirdparty%2Fman-pages.git getutent.3: EXAMPLES: Fix use of time(3) time(ptr) was wrong here, because struct utmp::ut_time is a int32_t, not a time_t. Also, the use of time(ptr) is obsolete, and time(NULL) is always preferred. Signed-off-by: Alejandro Colomar --- diff --git a/man3/getutent.3 b/man3/getutent.3 index 494b707d2b..5f3d2510a4 100644 --- a/man3/getutent.3 +++ b/man3/getutent.3 @@ -327,7 +327,7 @@ main(void) strcpy(entry.ut_line, ttyname(STDIN_FILENO) + strlen("/dev/")); /* only correct for ptys named /dev/tty[pqr][0\-9a\-z] */ strcpy(entry.ut_id, ttyname(STDIN_FILENO) + strlen("/dev/tty")); - time(&entry.ut_time); + entry.ut_time = time(NULL); strcpy(entry.ut_user, getpwuid(getuid())\->pw_name); memset(entry.ut_host, 0, UT_HOSTSIZE); entry.ut_addr = 0;