be consistent about sun_path length
Most places use the whole buffer for name, without leaving extra space for the trailing NUL.
This commit is contained in:
+1
-1
@@ -892,7 +892,7 @@ static int manager_setup_notify(Manager *m) {
|
||||
(void) mkdir_parents_label(m->notify_socket, 0755);
|
||||
(void) unlink(m->notify_socket);
|
||||
|
||||
strncpy(sa.un.sun_path, m->notify_socket, sizeof(sa.un.sun_path)-1);
|
||||
strncpy(sa.un.sun_path, m->notify_socket, sizeof(sa.un.sun_path));
|
||||
r = bind(fd, &sa.sa, SOCKADDR_UN_LEN(sa.un));
|
||||
if (r < 0)
|
||||
return log_error_errno(errno, "bind(%s) failed: %m", sa.un.sun_path);
|
||||
|
||||
@@ -160,7 +160,7 @@ static int get_seat_from_display(const char *display, const char **seat, uint32_
|
||||
r = socket_from_display(display, &p);
|
||||
if (r < 0)
|
||||
return r;
|
||||
strncpy(sa.un.sun_path, p, sizeof(sa.un.sun_path)-1);
|
||||
strncpy(sa.un.sun_path, p, sizeof(sa.un.sun_path));
|
||||
|
||||
fd = socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0);
|
||||
if (fd < 0)
|
||||
|
||||
+1
-1
@@ -2826,7 +2826,7 @@ static int setup_sd_notify_child(void) {
|
||||
(void) mkdir_parents(NSPAWN_NOTIFY_SOCKET_PATH, 0755);
|
||||
(void) unlink(NSPAWN_NOTIFY_SOCKET_PATH);
|
||||
|
||||
strncpy(sa.un.sun_path, NSPAWN_NOTIFY_SOCKET_PATH, sizeof(sa.un.sun_path)-1);
|
||||
strncpy(sa.un.sun_path, NSPAWN_NOTIFY_SOCKET_PATH, sizeof(sa.un.sun_path));
|
||||
r = bind(fd, &sa.sa, SOCKADDR_UN_LEN(sa.un));
|
||||
if (r < 0) {
|
||||
safe_close(fd);
|
||||
|
||||
Reference in New Issue
Block a user