]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: suppress warning
authorMatteo Croce <teknoraver@meta.com>
Tue, 12 Aug 2025 16:53:59 +0000 (18:53 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Tue, 12 Aug 2025 18:45:04 +0000 (19:45 +0100)
Avoid definition of `exec_context_get_tty_for_pam` if pam support is
disabled, to avoid the following warning:
```
../src/core/exec-invoke.c:1231:12: warning: ‘exec_context_get_tty_for_pam’ defined but not used [-Wunused-function]
 1231 | static int exec_context_get_tty_for_pam(const ExecContext *context, char **ret) {
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

src/core/exec-invoke.c

index 7a36d8c1c364ca2c28540f9246c37da86b852e7f..ddf888ee8a216625289ecf42a1f66c36a640475a 100644 (file)
@@ -1228,6 +1228,7 @@ static int attach_to_subcgroup(
         return 0;
 }
 
+#if HAVE_PAM
 static int exec_context_get_tty_for_pam(const ExecContext *context, char **ret) {
         _cleanup_free_ char *tty = NULL;
         int r;
@@ -1282,6 +1283,7 @@ static int exec_context_get_tty_for_pam(const ExecContext *context, char **ret)
         *ret = TAKE_PTR(tty);
         return 1;
 }
+#endif
 
 static int setup_pam(
                 const ExecContext *context,