X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fjournal%2Fjournald-native.c;h=3c60b22eaf5550af35c2de30fb7afb4fa5f48077;hp=ace8d5cbfd40b93b93414fbe29b24d520b06096d;hb=ed6d629a3487105e31415db9e175dd698ac20125;hpb=a09abc4ae0bdc0200324eaa0416f23ff2170ec4e diff --git a/src/journal/journald-native.c b/src/journal/journald-native.c index ace8d5cbf..3c60b22ea 100644 --- a/src/journal/journald-native.c +++ b/src/journal/journald-native.c @@ -70,15 +70,15 @@ bool valid_user_field(const char *p, size_t l, bool allow_protected) { return true; } -static bool allow_object_pid(struct ucred *ucred) { +static bool allow_object_pid(const struct ucred *ucred) { return ucred && ucred->uid == 0; } void server_process_native_message( Server *s, const void *buffer, size_t buffer_size, - struct ucred *ucred, - struct timeval *tv, + const struct ucred *ucred, + const struct timeval *tv, const char *label, size_t label_len) { struct iovec *iovec = NULL; @@ -303,8 +303,8 @@ finish: void server_process_native_file( Server *s, int fd, - struct ucred *ucred, - struct timeval *tv, + const struct ucred *ucred, + const struct timeval *tv, const char *label, size_t label_len) { struct stat st; @@ -412,7 +412,8 @@ void server_process_native_file( } int server_open_native_socket(Server*s) { - int one, r; + static const int one = 1; + int r; assert(s); @@ -440,7 +441,6 @@ int server_open_native_socket(Server*s) { } else fd_nonblock(s->native_fd, 1); - one = 1; r = setsockopt(s->native_fd, SOL_SOCKET, SO_PASSCRED, &one, sizeof(one)); if (r < 0) { log_error("SO_PASSCRED failed: %m"); @@ -449,14 +449,12 @@ int server_open_native_socket(Server*s) { #ifdef HAVE_SELINUX if (mac_selinux_use()) { - one = 1; r = setsockopt(s->native_fd, SOL_SOCKET, SO_PASSSEC, &one, sizeof(one)); if (r < 0) log_warning("SO_PASSSEC failed: %m"); } #endif - one = 1; r = setsockopt(s->native_fd, SOL_SOCKET, SO_TIMESTAMP, &one, sizeof(one)); if (r < 0) { log_error("SO_TIMESTAMP failed: %m");