lib/utmp.c: prepare_utmp(): Use xstrdup() instead of its pattern
Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
committed by
Serge Hallyn
parent
3c09e40a1f
commit
103ffc5b1d
10
lib/utmp.c
10
lib/utmp.c
@@ -250,16 +250,12 @@ prepare_utmp(const char *name, const char *line, const char *host,
|
||||
|
||||
|
||||
|
||||
if ( (NULL != host)
|
||||
&& ('\0' != host[0])) {
|
||||
hostname = XMALLOC(strlen(host) + 1, char);
|
||||
strcpy (hostname, host);
|
||||
if (NULL != host && '\0' != host[0])
|
||||
hostname = xstrdup(host);
|
||||
#if defined(HAVE_STRUCT_UTMPX_UT_HOST)
|
||||
} else if ( (NULL != ut)
|
||||
&& ('\0' != ut->ut_host[0])) {
|
||||
else if (NULL != ut && '\0' != ut->ut_host[0])
|
||||
hostname = XSTRNDUP(ut->ut_host);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (strncmp(line, "/dev/", 5) == 0) {
|
||||
line += 5;
|
||||
|
||||
Reference in New Issue
Block a user