diff options
Diffstat (limited to 'udev')
-rw-r--r-- | udev/ykfde.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/udev/ykfde.c b/udev/ykfde.c index c95237d..af08104 100644 --- a/udev/ykfde.c +++ b/udev/ykfde.c @@ -60,21 +60,21 @@ void received_signal(int signal) { } static int send_on_socket(int fd, const char *socket_name, const void *packet, size_t size) { - union { - struct sockaddr sa; - struct sockaddr_un un; - } sa = { - .un.sun_family = AF_UNIX, - }; - - strncpy(sa.un.sun_path, socket_name, sizeof(sa.un.sun_path)); - - if (sendto(fd, packet, size, MSG_NOSIGNAL, &sa.sa, offsetof(struct sockaddr_un, sun_path) + strlen(socket_name)) < 0) { - perror("sendto() failed"); - return EXIT_FAILURE; - } + union { + struct sockaddr sa; + struct sockaddr_un un; + } sa = { + .un.sun_family = AF_UNIX, + }; + + strncpy(sa.un.sun_path, socket_name, sizeof(sa.un.sun_path)); + + if (sendto(fd, packet, size, MSG_NOSIGNAL, &sa.sa, offsetof(struct sockaddr_un, sun_path) + strlen(socket_name)) < 0) { + perror("sendto() failed"); + return EXIT_FAILURE; + } - return EXIT_SUCCESS; + return EXIT_SUCCESS; } static int try_answer(YK_KEY * yk, uint8_t slot, const char * ask_file, char * challenge) { @@ -192,7 +192,7 @@ int main(int argc, char **argv) { /* read challenge */ char challenge[CHALLENGELEN + 1]; char challengefilename[sizeof(CHALLENGEDIR) + 11 /* "/challenge-" */ + 10 /* unsigned int in char */ + 1]; - int challengefile; + int challengefile; /* read dir */ DIR * dir; struct dirent * ent; |