This partially reverts
36c557f7d41441bbd98a8965348dfe8050fc9c98, which
introduced notify_remove_fd() that logs in LOG_DEBUG. However,
notify_remove_fd_warn() is still called other library functions, e.g.
notify_push_fd(), and produces warning message about the failure in
removing fd from fdstore on shutdown.
During shutdown process, we get the following logs:
```
systemd-udevd[370]: Failed to send notify message to '/run/systemd/notify': Connection refused
systemd-udevd[370]: Failed to remove file descriptor "config-serialization" from the store, ignoring: Connection refused
systemd-udevd[370]: Failed to send notify message to '/run/systemd/notify': Connection refused
systemd-udevd[370]: Failed to push serialization fd to service manager: Connection refused
```
Here, the 1st, 3rd, and 4th messages are in LOG_DEBUG, but the 2nd one
was in LOG_WARNING before this commit, and this makes it also in LOG_DEBUG.
Follow-up for
472404aca5357b7e65cdddf418342070b0ccd4d2.
#include "alloc-util.h"
#include "daemon-util.h"
+#include "errno-util.h"
#include "fd-util.h"
#include "log.h"
#include "string-util.h"
#include "time-util.h"
-static int notify_remove_fd_full(int log_level, const char *name) {
+int notify_remove_fd_warn(const char *name) {
int r;
assert(name);
"FDNAME=%s", name);
if (r < 0)
return log_full_errno(
- log_level, r,
+ ERRNO_IS_NEG_DISCONNECT(r) ? LOG_DEBUG : LOG_WARNING, r,
"Failed to remove file descriptor \"%s\" from the store, ignoring: %m",
name);
return 0;
}
-int notify_remove_fd(const char *name) {
- return notify_remove_fd_full(LOG_DEBUG, name);
-}
-
-int notify_remove_fd_warn(const char *name) {
- return notify_remove_fd_full(LOG_WARNING, name);
-}
-
int notify_remove_fd_warnf(const char *format, ...) {
_cleanup_free_ char *p = NULL;
va_list ap;
(void) sd_notify(false, *p);
}
-int notify_remove_fd(const char *name);
int notify_remove_fd_warn(const char *name);
int notify_remove_fd_warnf(const char *format, ...) _printf_(1, 2);
int close_and_notify_warn(int fd, const char *name);
/* We will start processing events in the loop below. Before starting processing, let's remove the
* event serialization fd from the fdstore, to avoid retrieving the serialized events again in future
* invocations. Otherwise, the serialized events may be processed multiple times. */
- (void) notify_remove_fd("event-serialization");
+ (void) notify_remove_fd_warn("event-serialization");
r = sd_event_loop(manager->event);
if (r < 0)