git: 5acbe6d1fb55 - main - pam_xdg: Reset rv to 0

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Tue, 27 Feb 2024 07:06:34 UTC
The branch main has been updated by manu:

URL: https://cgit.FreeBSD.org/src/commit/?id=5acbe6d1fb552eeaf44955c2780f2e9d4a70cad3

commit 5acbe6d1fb552eeaf44955c2780f2e9d4a70cad3
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2024-02-27 07:05:00 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2024-02-27 07:06:02 +0000

    pam_xdg: Reset rv to 0
    
    Otherwise on success it ontain the return value of asprintf.
    
    Sponsored by:   Beckhoff Automation GmbH & Co. KG
    Fixes:          2d2950c88933 ("pam_xdg: Check asprintf return value")
---
 lib/libpam/modules/pam_xdg/pam_xdg.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/libpam/modules/pam_xdg/pam_xdg.c b/lib/libpam/modules/pam_xdg/pam_xdg.c
index d8ba6899da2f..f1a9b13d581c 100644
--- a/lib/libpam/modules/pam_xdg/pam_xdg.c
+++ b/lib/libpam/modules/pam_xdg/pam_xdg.c
@@ -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);