From a2ae516a25dafe41e0cd296ab7b5d022fa62b95f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Thu, 19 Jun 2014 22:02:55 -0400
Subject: [PATCH] getty-generator: properly escape instance names

Otherwise the add_symlink() function tries to make directories for
each slash even for the slash after the @ symbol in the final link
name, failing for /dev/3270/tty1.

Based on a patch by Werner Fink <werner@suse.de>.
---
 src/getty-generator/getty-generator.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git src/getty-generator/getty-generator.c src/getty-generator/getty-generator.c
index 35cd858..7d4b546 100644
--- src/getty-generator/getty-generator.c
+++ src/getty-generator/getty-generator.c
@@ -67,7 +67,7 @@ static int add_serial_getty(const char *tty) {
 
         log_debug("Automatically adding serial getty for /dev/%s.", tty);
 
-        n = unit_name_replace_instance("serial-getty@.service", tty);
+        n = unit_name_from_path_instance("serial-getty", tty, ".service");
         if (!n)
                 return log_oom();
 
@@ -81,7 +81,7 @@ static int add_container_getty(const char *tty) {
 
         log_debug("Automatically adding container getty for /dev/pts/%s.", tty);
 
-        n = unit_name_replace_instance("container-getty@.service", tty);
+        n = unit_name_from_path_instance("container-getty", tty, ".service");
         if (!n)
                 return log_oom();
 
-- 
1.7.9.2

