Skip to content

Commit df8b604

Browse files
lib/utmp.c: Use STRNCPYTAIL() instead of its pattern
Signed-off-by: Alejandro Colomar <[email protected]>
1 parent 4fc3f69 commit df8b604

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/utmp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "string/strcmp/streq.h"
3535
#include "string/strcmp/strprefix.h"
3636
#include "string/strcpy/strncpy.h"
37+
#include "string/strcpy/strncpytail.h"
3738
#include "string/strcpy/strtcpy.h"
3839
#include "string/strdup/xstrdup.h"
3940
#include "string/strdup/xstrndup.h"
@@ -297,7 +298,7 @@ prepare_utmp(const char *name, const char *line, const char *host,
297298
&& ('\0' != ut->ut_id[0])) {
298299
STRNCPY(utent->ut_id, ut->ut_id);
299300
} else {
300-
STRNCPY(utent->ut_id, strnul(line) - MIN(strlen(line), countof(utent->ut_id)));
301+
STRNCPYTAIL(utent->ut_id, line);
301302
}
302303
#if defined(HAVE_STRUCT_UTMPX_UT_NAME)
303304
STRNCPY(utent->ut_name, name);

0 commit comments

Comments
 (0)