pam_xdg: Reset rv to 0

Otherwise on success it ontain the return value of asprintf.

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Fixes:		2d2950c889 ("pam_xdg: Check asprintf return value")
This commit is contained in:
Emmanuel Vadot 2024-02-27 08:05:00 +01:00
parent 2d2950c889
commit 5acbe6d1fb

View file

@ -151,6 +151,7 @@ _pam_xdg_open(pam_handle_t *pamh, int flags __unused,
rv = PAM_SESSION_ERR;
goto out;
}
rv = 0;
session_file = openat(rt_dir_prefix, xdg_session_file, O_CREAT | O_EXCL, RUNTIME_DIR_MODE);
free(xdg_session_file);
if (session_file >= 0)
@ -272,6 +273,7 @@ _pam_xdg_close(pam_handle_t *pamh __unused, int flags __unused,
rv = PAM_SESSION_ERR;
goto out;
}
rv = 0;
session_file = openat(rt_dir_prefix, xdg_session_file, 0);
if (session_file >= 0) {
unlinkat(rt_dir_prefix, xdg_session_file, 0);