]> sourceware.org Git - glibc.git/commitdiff
Fix PF_LOCAL socket example sockaddr_un size calculation.
authorRoland McGrath <roland@hack.frob.com>
Fri, 8 Feb 2013 22:55:50 +0000 (14:55 -0800)
committerRoland McGrath <roland@hack.frob.com>
Fri, 8 Feb 2013 22:55:50 +0000 (14:55 -0800)
ChangeLog
manual/examples/mkfsock.c

index 27cbc6ddfee5fc3a32e395d881332dd83b68602e..f3c8d4e78cc0b79e9004147d5fb920ef77010e57 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-02-08  Roland McGrath  <roland@hack.frob.com>
+
+       * manual/examples/mkfsock.c (make_named_socket): Don't add one for
+       the '\0' terminator.
+
 2013-02-08  Joseph Myers  <joseph@codesourcery.com>
 
        [BZ #13550]
index 1469e02fc437113e7523b094378dcae41a0dcc69..1a2b7f19fb2e1019c236292450daae825d65b669 100644 (file)
@@ -45,13 +45,12 @@ make_named_socket (const char *filename)
 
   /* The size of the address is
      the offset of the start of the filename,
-     plus its length,
-     plus one for the terminating null byte.
+     plus its length (not including the terminating null byte).
      Alternatively you can just do:
      size = SUN_LEN (&name);
   */
   size = (offsetof (struct sockaddr_un, sun_path)
-         + strlen (name.sun_path) + 1);
+         + strlen (name.sun_path));
 
   if (bind (sock, (struct sockaddr *) &name, size) < 0)
     {
This page took 0.113828 seconds and 5 git commands to generate.