chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
treewide: auto-convert the simple cases to log_*_errno()
[elogind.git]
/
src
/
journal
/
journald-stream.c
diff --git
a/src/journal/journald-stream.c
b/src/journal/journald-stream.c
index c46ffe5d455e0345b55f805c49f1255a6ecf5361..580f74624946224260e6cc944ba7d6691b76003b 100644
(file)
--- a/
src/journal/journald-stream.c
+++ b/
src/journal/journald-stream.c
@@
-341,8
+341,7
@@
void stdout_stream_free(StdoutStream *s) {
s->event_source = sd_event_source_unref(s->event_source);
}
s->event_source = sd_event_source_unref(s->event_source);
}
- if (s->fd >= 0)
- close_nointr_nofail(s->fd);
+ safe_close(s->fd);
#ifdef HAVE_SELINUX
if (s->security_context)
#ifdef HAVE_SELINUX
if (s->security_context)
@@
-377,13
+376,13
@@
static int stdout_stream_new(sd_event_source *es, int listen_fd, uint32_t revent
if (s->n_stdout_streams >= STDOUT_STREAMS_MAX) {
log_warning("Too many stdout streams, refusing connection.");
if (s->n_stdout_streams >= STDOUT_STREAMS_MAX) {
log_warning("Too many stdout streams, refusing connection.");
-
close_nointr_nofail
(fd);
+
safe_close
(fd);
return 0;
}
stream = new0(StdoutStream, 1);
if (!stream) {
return 0;
}
stream = new0(StdoutStream, 1);
if (!stream) {
-
close_nointr_nofail
(fd);
+
safe_close
(fd);
return log_oom();
}
return log_oom();
}
@@
-396,7
+395,7
@@
static int stdout_stream_new(sd_event_source *es, int listen_fd, uint32_t revent
}
#ifdef HAVE_SELINUX
}
#ifdef HAVE_SELINUX
- if (
use_selinux
()) {
+ if (
mac_selinux_use
()) {
if (getpeercon(fd, &stream->security_context) < 0 && errno != ENOPROTOOPT)
log_error("Failed to determine peer security context: %m");
}
if (getpeercon(fd, &stream->security_context) < 0 && errno != ENOPROTOOPT)
log_error("Failed to determine peer security context: %m");
}
@@
-409,13
+408,13
@@
static int stdout_stream_new(sd_event_source *es, int listen_fd, uint32_t revent
r = sd_event_add_io(s->event, &stream->event_source, fd, EPOLLIN, stdout_stream_process, stream);
if (r < 0) {
r = sd_event_add_io(s->event, &stream->event_source, fd, EPOLLIN, stdout_stream_process, stream);
if (r < 0) {
- log_error
("Failed to add stream to event loop: %s", strerror(-r)
);
+ log_error
_errno(-r, "Failed to add stream to event loop: %m"
);
goto fail;
}
r = sd_event_source_set_priority(stream->event_source, SD_EVENT_PRIORITY_NORMAL+5);
if (r < 0) {
goto fail;
}
r = sd_event_source_set_priority(stream->event_source, SD_EVENT_PRIORITY_NORMAL+5);
if (r < 0) {
- log_error
("Failed to adjust stdout event source priority: %s", strerror(-r)
);
+ log_error
_errno(-r, "Failed to adjust stdout event source priority: %m"
);
goto fail;
}
goto fail;
}
@@
-451,14
+450,14
@@
int server_open_stdout_socket(Server *s) {
r = bind(s->stdout_fd, &sa.sa, offsetof(union sockaddr_union, un.sun_path) + strlen(sa.un.sun_path));
if (r < 0) {
r = bind(s->stdout_fd, &sa.sa, offsetof(union sockaddr_union, un.sun_path) + strlen(sa.un.sun_path));
if (r < 0) {
- log_error("bind(
) failed: %m"
);
+ log_error("bind(
%s) failed: %m", sa.un.sun_path
);
return -errno;
}
chmod(sa.un.sun_path, 0666);
if (listen(s->stdout_fd, SOMAXCONN) < 0) {
return -errno;
}
chmod(sa.un.sun_path, 0666);
if (listen(s->stdout_fd, SOMAXCONN) < 0) {
- log_error("listen(
) failed: %m"
);
+ log_error("listen(
%s) failed: %m", sa.un.sun_path
);
return -errno;
}
} else
return -errno;
}
} else
@@
-466,13
+465,13
@@
int server_open_stdout_socket(Server *s) {
r = sd_event_add_io(s->event, &s->stdout_event_source, s->stdout_fd, EPOLLIN, stdout_stream_new, s);
if (r < 0) {
r = sd_event_add_io(s->event, &s->stdout_event_source, s->stdout_fd, EPOLLIN, stdout_stream_new, s);
if (r < 0) {
- log_error
("Failed to add stdout server fd to event source: %s", strerror(-r)
);
+ log_error
_errno(-r, "Failed to add stdout server fd to event source: %m"
);
return r;
}
r = sd_event_source_set_priority(s->stdout_event_source, SD_EVENT_PRIORITY_NORMAL+10);
if (r < 0) {
return r;
}
r = sd_event_source_set_priority(s->stdout_event_source, SD_EVENT_PRIORITY_NORMAL+10);
if (r < 0) {
- log_error
("Failed to adjust priority of stdout server event source: %s", strerror(-r)
);
+ log_error
_errno(-r, "Failed to adjust priority of stdout server event source: %m"
);
return r;
}
return r;
}