summaryrefslogtreecommitdiff
path: root/src/journal
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-12-24 15:53:04 +0100
committerLennart Poettering <lennart@poettering.net>2013-12-24 15:53:04 +0100
commiteff05270986a13e7de93ae16311f654d3f7c166f (patch)
treec5c7d7c456f8a8b9d3e75cb9e36b5974215003ed /src/journal
parent96415cad2fdd8d280ae94b02651b5f826a2f7f3d (diff)
util: unify SO_PEERCRED/SO_PEERSEC invocations
Introduce new call getpeercred() which internally just uses SO_PEERCRED but checks if the returned data is actually useful due to namespace quirks.
Diffstat (limited to 'src/journal')
-rw-r--r--src/journal/journald-stream.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/journal/journald-stream.c b/src/journal/journald-stream.c
index aba9054b27..c032ee4a0e 100644
--- a/src/journal/journald-stream.c
+++ b/src/journal/journald-stream.c
@@ -354,7 +354,6 @@ static int stdout_stream_new(sd_event_source *es, int listen_fd, uint32_t revent
Server *s = userdata;
StdoutStream *stream;
int fd, r;
- socklen_t len;
assert(s);
@@ -386,8 +385,8 @@ static int stdout_stream_new(sd_event_source *es, int listen_fd, uint32_t revent
stream->fd = fd;
- len = sizeof(stream->ucred);
- if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &stream->ucred, &len) < 0) {
+ r = getpeercred(fd, &stream->ucred);
+ if (r < 0) {
log_error("Failed to determine peer credentials: %m");
goto fail;
}