chiark / gitweb /
util: introduce mkdir_parents() that creates parent paths of sockets and suchlike
[elogind.git] / socket-util.c
index 46a6e91bb0497554e54feba267695fc8f207f9a8..0f5140ec5b9769a17d963c9e7c19a7dc271e28d6 100644 (file)
@@ -1,5 +1,24 @@
 /*-*- Mode: C; c-basic-offset: 8 -*-*/
 
+/***
+  This file is part of systemd.
+
+  Copyright 2010 Lennart Poettering
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
 #include <assert.h>
 #include <string.h>
 #include <unistd.h>
@@ -69,7 +88,7 @@ int socket_address_parse(SocketAddress *a, const char *s) {
                 memcpy(a->sockaddr.un.sun_path, s, l);
                 a->size = sizeof(sa_family_t) + l + 1;
 
-        } else if (*s == '=') {
+        } else if (*s == '@') {
                 /* Abstract AF_UNIX socket */
                 size_t l;
 
@@ -84,7 +103,6 @@ int socket_address_parse(SocketAddress *a, const char *s) {
         } else {
 
                 if ((e = strchr(s, ':'))) {
-                        int r;
 
                         if ((r = safe_atou(e+1, &u)) < 0)
                                 return r;
@@ -261,7 +279,7 @@ int socket_address_print(const SocketAddress *a, char **p) {
                                 if (!(ret = new(char, sizeof(a->sockaddr.un.sun_path)+1)))
                                         return -ENOMEM;
 
-                                ret[0] = '=';
+                                ret[0] = '@';
                                 memcpy(ret+1, a->sockaddr.un.sun_path+1, sizeof(a->sockaddr.un.sun_path)-1);
                                 ret[sizeof(a->sockaddr.un.sun_path)] = 0;