Problem reported by Thorsten Kukuk <https://bugs.gnu.org/65617>.
* lib/readutmp.c (read_utmp_from_systemd):
Don’t assume session_ptr != NULL if num_sessions == 0.
In practice it can be null, and the man page OKs this behavior.
+2023-08-30 Paul Eggert <eggert@cs.ucla.edu>
+
+ readutmp: fix core dump if --enable-systemd
+ Problem reported by Thorsten Kukuk <https://bugs.gnu.org/65617>.
+ * lib/readutmp.c (read_utmp_from_systemd):
+ Don’t assume session_ptr != NULL if num_sessions == 0.
+ In practice it can be null, and the man page OKs this behavior.
+
2023-08-30 Bruno Haible <bruno@clisp.org>
doc: Mention the module 'wchar-single'.
{
char **sessions;
int num_sessions = sd_get_sessions (&sessions);
- if (num_sessions >= 0)
+ if (num_sessions > 0)
{
char **session_ptr;
for (session_ptr = sessions; *session_ptr != NULL; session_ptr++)