aboutsummaryrefslogtreecommitdiffstats
path: root/bindtemp_un.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2024-05-05 10:28:31 +0200
committerMattias Andrée <maandree@kth.se>2024-05-05 10:28:31 +0200
commitd33c5c0a18017ae658feb4a3344dd810cc87050b (patch)
tree020748a839ab162379a3235ed59d126c43491cc6 /bindtemp_un.c
parentlibsimple_abspath: accept NULL for cwd (diff)
downloadlibsimple-d33c5c0a18017ae658feb4a3344dd810cc87050b.tar.gz
libsimple-d33c5c0a18017ae658feb4a3344dd810cc87050b.tar.bz2
libsimple-d33c5c0a18017ae658feb4a3344dd810cc87050b.tar.xz
m + add ascii.h and exec.h
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--bindtemp_un.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/bindtemp_un.c b/bindtemp_un.c
index 0362e47..5f0de05 100644
--- a/bindtemp_un.c
+++ b/bindtemp_un.c
@@ -57,8 +57,8 @@ libsimple_bindtemp_un(int fd, int dir_fd, struct sockaddr_un *addr, socklen_t *a
len = snprintf(addr->sun_path, sizeof(addr->sun_path), "/dev/fd/%i/tmp", dir_fd);
if (len < 0 || (size_t)len >= sizeof(addr->sun_path) || sizeof(addr->sun_path) - (size_t)len < 6)
abort();
- rem = sizeof(addr->sun_path) - 1 - len;
- addr->sun_path[sizeof(addr->sun_path) - 1] = 0;
+ rem = sizeof(addr->sun_path) - 1U - (size_t)len;
+ addr->sun_path[sizeof(addr->sun_path) - 1U] = 0;
while (try_limit--) {
again:
@@ -67,7 +67,7 @@ libsimple_bindtemp_un(int fd, int dir_fd, struct sockaddr_un *addr, socklen_t *a
errno = saved_errno;
return 0;
} else if (errno == ENAMETOOLONG && rem > 5) {
- addr->sun_path[len + --rem] = 0;
+ addr->sun_path[(size_t)len + --rem] = 0;
goto again;
} else if (errno != EEXIST && errno != EADDRINUSE) {
return -1;