]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - manual/examples/mkfsock.c
Prefer https to http for gnu.org and fsf.org URLs
[thirdparty/glibc.git] / manual / examples / mkfsock.c
index 1469e02fc437113e7523b094378dcae41a0dcc69..4372225103a6ba64df6ed0323240e56659ff70c5 100644 (file)
@@ -1,5 +1,5 @@
 /* Example of Local-Namespace Sockets
-   Copyright (C) 1991-2013 Free Software Foundation, Inc.
+   Copyright (C) 1991-2019 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
@@ -12,7 +12,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, if not, see <http://www.gnu.org/licenses/>.
+   along with this program; if not, see <https://www.gnu.org/licenses/>.
 */
 
 #include <stddef.h>
@@ -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)
     {