chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
service: prefix description with LSB only if script has LSB header, use 'SysV:' otherwise
[elogind.git]
/
src
/
reply-password.c
diff --git
a/src/reply-password.c
b/src/reply-password.c
index 236fdcc94cc585d930bdcca757b6035240d20a15..575a437645283497ee70fb0a6d7d512474bc7d94 100644
(file)
--- a/
src/reply-password.c
+++ b/
src/reply-password.c
@@
-31,6
+31,7
@@
#include <sys/stat.h>
#include <sys/signalfd.h>
#include <getopt.h>
#include <sys/stat.h>
#include <sys/signalfd.h>
#include <getopt.h>
+#include <stddef.h>
#include "log.h"
#include "macro.h"
#include "log.h"
#include "macro.h"
@@
-48,9
+49,9
@@
static int send_on_socket(int fd, const char *socket_name, const void *packet, s
zero(sa);
sa.un.sun_family = AF_UNIX;
zero(sa);
sa.un.sun_family = AF_UNIX;
- strncpy(sa.un.sun_path
+1, socket_name, sizeof(sa.un.sun_path)-1
);
+ strncpy(sa.un.sun_path
, socket_name, sizeof(sa.un.sun_path)
);
- if (sendto(fd, packet, size, MSG_NOSIGNAL, &sa.sa,
sizeof(sa_family_t) + 1
+ strlen(socket_name)) < 0) {
+ if (sendto(fd, packet, size, MSG_NOSIGNAL, &sa.sa,
offsetof(struct sockaddr_un, sun_path)
+ strlen(socket_name)) < 0) {
log_error("Failed to send: %m");
return -1;
}
log_error("Failed to send: %m");
return -1;
}