chiark / gitweb /
arch: remove welcome message
[elogind.git] / src / util.c
index 861f9eaa437ba8c5fbe7f768979473cabfc8ee82..2c7b1f9a56bd4cd7ae0f83619668a49eaeba4cbe 100644 (file)
@@ -495,6 +495,9 @@ int write_one_line_file(const char *fn, const char *line) {
                 goto finish;
         }
 
+        if (!endswith(line, "\n"))
+                fputc('\n', f);
+
         r = 0;
 finish:
         fclose(f);
@@ -3044,12 +3047,20 @@ void status_welcome(void) {
 #elif defined(TARGET_DEBIAN)
 
         if (!pretty_name) {
-                if ((r = read_one_line_file("/etc/debian_version", &pretty_name)) < 0) {
+                char *version;
+
+                if ((r = read_one_line_file("/etc/debian_version", &version)) < 0) {
 
                         if (r != -ENOENT)
                                 log_warning("Failed to read /etc/debian_version: %s", strerror(-r));
-                } else
-                        truncate_nl(pretty_name);
+                } else {
+                        truncate_nl(version);
+                        pretty_name = strappend("Debian ", version);
+                        free(version);
+
+                        if (!pretty_name)
+                                log_warning("Failed to allocate Debian version string.");
+                }
         }
 
         if (!ansi_color)
@@ -3068,13 +3079,6 @@ void status_welcome(void) {
         if (!ansi_color)
                 const_color = "0;33"; /* Orange/Brown for Ubuntu */
 
-#elif defined(TARGET_ARCH)
-
-        if (!pretty_name)
-                const_pretty = "Arch Linux";
-
-        if (!ansi_color)
-                const_color = "1;36"; /* Cyan for Arch */
 #endif
 
         if (!pretty_name && !const_pretty)
@@ -3375,6 +3379,8 @@ int wait_for_terminate_and_warn(const char *name, pid_t pid) {
 }
 
 void freeze(void) {
+        sync();
+
         for (;;)
                 pause();
 }
@@ -3391,8 +3397,8 @@ bool null_or_empty(struct stat *st) {
         return false;
 }
 
-DIR *xopendirat(int fd, const char *name) {
-        return fdopendir(openat(fd, name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC));
+DIR *xopendirat(int fd, const char *name, int flags) {
+        return fdopendir(openat(fd, name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|flags));
 }
 
 int signal_from_string_try_harder(const char *s) {