chiark / gitweb /
bus-policy: append items rather than prepending them
[elogind.git] / src / getty-generator / getty-generator.c
index 35cd8589fcdb1f88df66b9ea4bf183e02a422bba..06ca9b9662cb44cf5be1dfc6a62ac071a41f448a 100644 (file)
@@ -42,7 +42,7 @@ static int add_symlink(const char *fservice, const char *tservice) {
         assert(tservice);
 
         from = strappenda(SYSTEM_DATA_UNIT_PATH "/", fservice);
-        to = strappenda3(arg_dest, "/getty.target.wants/", tservice);
+        to = strappenda(arg_dest, "/getty.target.wants/", tservice);
 
         mkdir_parents_label(to, 0755);
 
@@ -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();
 
@@ -154,14 +154,14 @@ int main(int argc, char *argv[]) {
 
                 r = getenv_for_pid(1, "container_ttys", &container_ttys);
                 if (r > 0) {
-                        char *w, *state;
+                        const char *word, *state;
                         size_t l;
 
-                        FOREACH_WORD(w, l, container_ttys, state) {
+                        FOREACH_WORD(word, l, container_ttys, state) {
                                 const char *t;
                                 char tty[l + 1];
 
-                                memcpy(tty, w, l);
+                                memcpy(tty, word, l);
                                 tty[l] = 0;
 
                                 /* First strip off /dev/ if it is specified */
@@ -184,15 +184,15 @@ int main(int argc, char *argv[]) {
         }
 
         if (read_one_line_file("/sys/class/tty/console/active", &active) >= 0) {
-                char *w, *state;
+                const char *word, *state;
                 size_t l;
 
                 /* Automatically add in a serial getty on all active
                  * kernel consoles */
-                FOREACH_WORD(w, l, active, state) {
+                FOREACH_WORD(word, l, active, state) {
                         _cleanup_free_ char *tty = NULL;
 
-                        tty = strndup(w, l);
+                        tty = strndup(word, l);
                         if (!tty) {
                                 log_oom();
                                 return EXIT_FAILURE;