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

« back to all changes in this revision

Viewing changes to src/tty-ask-password-agent/tty-ask-password-agent.c

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

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
                char ***_passphrases) {
61
61
 
62
62
        int fd = -1, notify = -1;
63
 
        union sockaddr_union sa;
 
63
        union sockaddr_union sa = {};
64
64
        char *packet = NULL;
65
65
        ssize_t k;
66
66
        int r, n;
67
 
        struct pollfd pollfd[2];
 
67
        struct pollfd pollfd[2] = {};
68
68
        char buffer[LINE_MAX];
69
69
        size_t p = 0;
70
70
        enum {
91
91
                goto finish;
92
92
        }
93
93
 
94
 
        zero(sa);
95
94
        sa.sa.sa_family = AF_UNIX;
96
95
        strncpy(sa.un.sun_path+1, "/org/freedesktop/plymouthd", sizeof(sa.un.sun_path)-1);
97
96
        if (connect(fd, &sa.sa, offsetof(struct sockaddr_un, sun_path) + 1 + strlen(sa.un.sun_path+1)) < 0) {
116
115
                goto finish;
117
116
        }
118
117
 
119
 
        zero(pollfd);
120
118
        pollfd[POLL_SOCKET].fd = fd;
121
119
        pollfd[POLL_SOCKET].events = POLLIN;
122
120
        pollfd[POLL_INOTIFY].fd = notify;
277
275
                return -errno;
278
276
        }
279
277
 
280
 
        r = config_parse(filename, f, NULL, config_item_table_lookup, (void*) items, true, NULL);
 
278
        r = config_parse(NULL, filename, f, NULL, config_item_table_lookup, (void*) items, true, NULL);
281
279
        if (r < 0) {
282
280
                log_error("Failed to parse password file %s: %s", filename, strerror(-r));
283
281
                goto finish;
325
323
                union {
326
324
                        struct sockaddr sa;
327
325
                        struct sockaddr_un un;
328
 
                } sa;
 
326
                } sa = {};
329
327
                size_t packet_length = 0;
330
328
 
331
329
                assert(arg_action == ACTION_QUERY ||
341
339
                }
342
340
 
343
341
                if (arg_plymouth) {
344
 
                        char **passwords = NULL;
 
342
                        _cleanup_strv_free_ char **passwords = NULL;
345
343
 
346
344
                        if ((r = ask_password_plymouth(message, not_after, filename, accept_cached, &passwords)) >= 0) {
347
345
                                char **p;
410
408
                        goto finish;
411
409
                }
412
410
 
413
 
                zero(sa);
414
411
                sa.un.sun_family = AF_UNIX;
415
412
                strncpy(sa.un.sun_path, socket_name, sizeof(sa.un.sun_path));
416
413
 
563
560
        };
564
561
 
565
562
        int notify = -1, signal_fd = -1, tty_block_fd = -1;
566
 
        struct pollfd pollfd[_FD_MAX];
 
563
        struct pollfd pollfd[_FD_MAX] = {};
567
564
        sigset_t mask;
568
565
        int r;
569
566
 
591
588
                goto finish;
592
589
        }
593
590
 
594
 
        zero(pollfd);
595
591
        pollfd[FD_INOTIFY].fd = notify;
596
592
        pollfd[FD_INOTIFY].events = POLLIN;
597
593
        pollfd[FD_SIGNAL].fd = signal_fd;