From 2eee4c67f5b13c91b9a783a1ba4dd95b28ae0bfb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Christian=20G=C3=B6ttsche?= Date: Sat, 1 Apr 2023 13:44:48 +0200 Subject: [PATCH] sssd: skip flushing if executable does not exist Avoid unnecessary syslog output, like: Apr 01 13:35:09 dlaptop userdel[45872]: userdel: sss_cache exited with status 1 Apr 01 13:35:09 dlaptop userdel[45872]: userdel: Failed to flush the sssd cache. --- lib/sssd.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/sssd.c b/lib/sssd.c index 2da920a86..dd547290f 100644 --- a/lib/sssd.c +++ b/lib/sssd.c @@ -4,6 +4,7 @@ #ifdef USE_SSSD #include +#include #include #include @@ -21,11 +22,16 @@ int sssd_flush_cache (int dbflags) { int status, code, rv; const char *cmd = "/usr/sbin/sss_cache"; + struct stat sb; char *sss_cache_args = NULL; const char *spawnedArgs[] = {"sss_cache", NULL, NULL}; const char *spawnedEnv[] = {NULL}; int i = 0; + rv = stat(cmd, &sb); + if (rv == -1 && errno == ENOENT) + return 0; + sss_cache_args = MALLOCARRAY(4, char); if (sss_cache_args == NULL) { return -1; -- 2.47.2