[PATCH] fix old socket name after 9de731ed and 3ec007a4

Andrey Borzenkov arvidjaar at gmail.com
Thu Nov 18 10:35:11 PST 2010


Commit 9de731ed29db4670c1641aedd945c56fd1a3feed caused
plymouth to lose leading '\0' on old abstract socket
making it incompatible with older server. As result new
client (after update) can no more communicate with old
running server (or older server as part of initrd).

Restore proper behaviour of having leading '\0' for both
abstract sockets, trimmed and non-trimmed.

Commit 3ec007a4820e53aed6713620173bd997957754ec did not
check for success with old socket path and failed
always. Properly check for success and proceed.

Signed-off-by: Andrey Borzenkov <arvidjaar at gmail.com>

---
 src/client/ply-boot-client.c |    7 +++++--
 src/libply/ply-utils.c       |    2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/client/ply-boot-client.c b/src/client/ply-boot-client.c
index 74979c9..cfd763f 100644
--- a/src/client/ply-boot-client.c
+++ b/src/client/ply-boot-client.c
@@ -191,8 +191,11 @@ ply_boot_client_connect (ply_boot_client_t *client,
       client->socket_fd =
           ply_connect_to_unix_socket (PLY_BOOT_PROTOCOL_OLD_ABSTRACT_SOCKET_PATH,
                                       PLY_UNIX_SOCKET_TYPE_ABSTRACT);
-      ply_trace ("could not connect to " PLY_BOOT_PROTOCOL_OLD_ABSTRACT_SOCKET_PATH ": %m");
-      return false;
+      if (client->socket_fd < 0)
+        {
+          ply_trace ("could not connect to " PLY_BOOT_PROTOCOL_OLD_ABSTRACT_SOCKET_PATH ": %m");
+          return false;
+        }
     }
 
   client->disconnect_handler = disconnect_handler;
diff --git a/src/libply/ply-utils.c b/src/libply/ply-utils.c
index 2685543..5b06e49 100644
--- a/src/libply/ply-utils.c
+++ b/src/libply/ply-utils.c
@@ -161,7 +161,7 @@ create_unix_address_from_path (const char             *path,
    * Note, we depend on the memory being zeroed by the calloc
    * call above.
    */
-  if (type == PLY_UNIX_SOCKET_TYPE_ABSTRACT)
+  if (type == PLY_UNIX_SOCKET_TYPE_CONCRETE)
     strncpy (address->sun_path, path, sizeof (address->sun_path) - 1);
   else
     strncpy (address->sun_path + 1, path, sizeof (address->sun_path) - 1);
-- 
tg: (48f04ad..) upstream/abstract-socket (depends on: master)


More information about the plymouth mailing list