summary refs log tree commit diff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-12-11 19:35:07 +0000
committerLaurent Bercot <ska@appnovation.com>2023-12-11 19:35:07 +0000
commit4f3d7b365af04b147f99486a86b89a8ff830b927 (patch)
tree9116154c5b7fceb1f31029afcae497855a9bf05d
parentb5375f1a9e911243a5fe497549b38829e5495261 (diff)
downloads6-4f3d7b365af04b147f99486a86b89a8ff830b927.tar.gz
s6-4f3d7b365af04b147f99486a86b89a8ff830b927.tar.xz
s6-4f3d7b365af04b147f99486a86b89a8ff830b927.zip
Adapt to working socket_recv46()
Signed-off-by: Laurent Bercot <ska@appnovation.com>
-rw-r--r--src/daemontools-extras/s6-socklog.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/daemontools-extras/s6-socklog.c b/src/daemontools-extras/s6-socklog.c
index 3b20275..a1b2639 100644
--- a/src/daemontools-extras/s6-socklog.c
+++ b/src/daemontools-extras/s6-socklog.c
@@ -49,6 +49,7 @@ int main (int argc, char const *const *argv)
 {
   iopause_fd x[3] = { { .events = IOPAUSE_READ }, { .fd = 1 } } ;
   int flagraw = 0 ;
+  int is6 = 0 ;
   char const *usock = "/dev/log" ;
   unsigned int linelen = 1024 ;
   PROG = "s6-socklog" ;
@@ -135,6 +136,7 @@ int main (int argc, char const *const *argv)
         fmtp[uint16_fmt(fmtp, port)] = 0 ;
         strerr_diefu5sys(111, "bind socket to ", "ip ", fmti, " port ", fmtp) ;
       }
+      is6 = ip46_is6(&ip) ;
     }
 
     if (gidn != (size_t)-1 && setgroups_and_gid(gid ? gid : getegid(), gidn, gids) < 0)
@@ -185,7 +187,7 @@ int main (int argc, char const *const *argv)
         {
           ip46 ip ;
           uint16_t port ;
-          r = sanitize_read(socket_recv46(x[2].fd, line, linelen + 1, &ip, &port)) ;
+          r = sanitize_read(socket_recv46(x[2].fd, line, linelen + 1, &ip, &port, is6)) ;
           if (r == -1) strerr_diefu1sys(111, "recv") ;
           if (r)
           {