run-as: reduce verbosity of fd sending error paths
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Mon, 26 Apr 2021 22:18:11 +0000 (18:18 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 28 Apr 2021 21:22:42 +0000 (17:22 -0400)
commita4c6418797c182f599f96ce31de64e1a02ac40b0
tree4c56ef91cc74e8bb3e7932d7a9047781a7723fa7
parentc989e0d419a78309fa488fbbd74761d81f9e1a42
run-as: reduce verbosity of fd sending error paths

Issue
=====

A testcase in `tests/regression/tools/save-load/test_save` tests that
saving a session on an already existing configuration file fails.

The test case fails as expected but it is a bit noisy in terms of error
reporting:
  ok 9 - Enable channel chan-save for session save-42
  ok 10 - Enable ust event tp:tptest for session save-42
  Error: Attempt to send invalid file descriptor to master (fd = -1)
  PERROR - 09:57:10.893683118 [Client management]: Could not create configuration file: File exists (in save_session() at save.c:2706)
  PERROR - 09:57:10.893714862 [Main]: Failed to close result file descriptor: Bad file descriptor (in send_fds_to_master() at runas.c:824)
  ok 11 - Session failed to be saved. Expected!

We see that 3 error statements are printed by the sessiond but only the
second is really relevant.

Fix
===

This commit:
- changes the first `ERR()` statement to a `DBG()` statement, and
- only call `close()` on seemingly valid FDs.

Notes
=====

This commit also removes the mention of "master" in the first `DBG()`
statement as this function is used by both the master and the runas
process.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ie77d44233a770610f8a3f4412b84c0fd70c0812e
src/common/runas.c
This page took 0.02538 seconds and 4 git commands to generate.