~ubuntu-branches/ubuntu/trusty/systemd/trusty

« back to all changes in this revision

Viewing changes to src/journal/journald-stream.c

Tags: upstream-202
ImportĀ upstreamĀ versionĀ 202

Show diffs side-by-side

added added

removed removed

Lines of Context:
175
175
 
176
176
        case STDOUT_STREAM_PRIORITY:
177
177
                r = safe_atoi(p, &s->priority);
178
 
                if (r < 0 || s->priority <= 0 || s->priority >= 999) {
 
178
                if (r < 0 || s->priority < 0 || s->priority > 999) {
179
179
                        log_warning("Failed to parse log priority line.");
180
180
                        return -EINVAL;
181
181
                }
412
412
}
413
413
 
414
414
int server_open_stdout_socket(Server *s) {
415
 
        union sockaddr_union sa;
416
415
        int r;
417
416
        struct epoll_event ev;
418
417
 
419
418
        assert(s);
420
419
 
421
420
        if (s->stdout_fd < 0) {
 
421
                union sockaddr_union sa = {
 
422
                        .un.sun_family = AF_UNIX,
 
423
                        .un.sun_path = "/run/systemd/journal/stdout",
 
424
                };
422
425
 
423
426
                s->stdout_fd = socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
424
427
                if (s->stdout_fd < 0) {
426
429
                        return -errno;
427
430
                }
428
431
 
429
 
                zero(sa);
430
 
                sa.un.sun_family = AF_UNIX;
431
 
                strncpy(sa.un.sun_path, "/run/systemd/journal/stdout", sizeof(sa.un.sun_path));
432
 
 
433
432
                unlink(sa.un.sun_path);
434
433
 
435
434
                r = bind(s->stdout_fd, &sa.sa, offsetof(union sockaddr_union, un.sun_path) + strlen(sa.un.sun_path));