Convert utmp{x}name to int, return useful value. Define _PATH_UTMPX

* syscalls.cc (utmpname): Convert to int.  Return 0 if strdup
	worked, -1 otherwise.
	* include/utmpx.h (_PATH_UTMPX): Define as _PATH_UTMP.
	(utmpxname): Declare as int function.
	* include/sys/utmp.h (utmpname): Ditto.
	* include/cygwin/version.h: Bump API minor version.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen
2016-01-07 15:40:40 +01:00
parent b8f9d8de2c
commit 80a800978b
6 changed files with 21 additions and 8 deletions

View File

@@ -3955,7 +3955,7 @@ endutent ()
}
}
extern "C" void
extern "C" int
utmpname (const char *file)
{
__try
@@ -3964,13 +3964,17 @@ utmpname (const char *file)
{
endutent ();
utmp_file = strdup (file);
debug_printf ("New UTMP file: %s", utmp_file);
return;
if (utmp_file)
{
debug_printf ("New UTMP file: %s", utmp_file);
return 0;
}
}
}
__except (NO_ERROR) {}
__except (EFAULT) {}
__endtry
debug_printf ("Invalid file");
debug_printf ("Setting UTMP file failed");
return -1;
}
EXPORT_ALIAS (utmpname, utmpxname)