chiark / gitweb /
test-env-replace: assert results instead of printing them
[elogind.git] / src / getty-generator / getty-generator.c
index 9e46a47a9ae9adbe86d68685f908b33c95b63cbb..cb38f21052e6e3ec476a4a5423e963d6b8a3c67d 100644 (file)
@@ -42,8 +42,7 @@ static int add_symlink(const char *fservice, const char *tservice) {
         to = strjoin(arg_dest,"/getty.target.wants/", tservice, NULL);
 
         if (!from || !to) {
-                log_error("Out of memory.");
-                r = -ENOMEM;
+                r = log_oom();
                 goto finish;
         }
 
@@ -77,10 +76,8 @@ 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);
-        if (!n) {
-                log_error("Out of memory.");
-                return -ENOMEM;
-        }
+        if (!n)
+                return log_oom();
 
         r = add_symlink("serial-getty@.service", n);
         free(n);
@@ -134,7 +131,7 @@ int main(int argc, char *argv[]) {
 
                 /* Automatically add in a serial getty on the kernel
                  * console */
-                if (tty_is_vc(tty))
+                if (isempty(tty) || tty_is_vc(tty))
                         free(active);
                 else {
                         int k;
@@ -160,7 +157,7 @@ int main(int argc, char *argv[]) {
                 int k;
 
                 if (asprintf(&p, "/sys/class/tty/%s", j) < 0) {
-                        log_error("Out of memory.");
+                        log_oom();
                         r = EXIT_FAILURE;
                         goto finish;
                 }