summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-04-16 01:48:02 +0200
committerLennart Poettering <lennart@poettering.net>2011-04-16 02:03:34 +0200
commit6f9a471aa677ff4048aea168d7cea3697cf51fb3 (patch)
tree3e938ced3c857d51c15b42c0ac9a5d310947d7b2 /src
parent8480e784f176a4911e22497e01bfbdf084342520 (diff)
util: truncate newline inside of read_one_line_file() already
Diffstat (limited to 'src')
-rw-r--r--src/cgroups-agent.c2
-rw-r--r--src/getty-generator.c1
-rw-r--r--src/util.c18
3 files changed, 6 insertions, 15 deletions
diff --git a/src/cgroups-agent.c b/src/cgroups-agent.c
index e0868b6137..7f001e67d1 100644
--- a/src/cgroups-agent.c
+++ b/src/cgroups-agent.c
@@ -43,7 +43,6 @@ int main(int argc, char *argv[]) {
log_parse_environment();
log_open();
-
/* We send this event to the private D-Bus socket and then the
* system instance will forward this to the system bus. We do
* this to avoid an activation loop when we start dbus when we
@@ -94,7 +93,6 @@ finish:
dbus_connection_unref(bus);
}
-
if (m)
dbus_message_unref(m);
diff --git a/src/getty-generator.c b/src/getty-generator.c
index f49f9eae99..683775a4d5 100644
--- a/src/getty-generator.c
+++ b/src/getty-generator.c
@@ -86,7 +86,6 @@ int main(int argc, char *argv[]) {
if (read_one_line_file("/sys/class/tty/console/active", &active) >= 0) {
const char *tty;
- truncate_nl(active);
if ((tty = strrchr(active, ' ')))
tty ++;
else
diff --git a/src/util.c b/src/util.c
index 39c9db72fc..fb8df84e19 100644
--- a/src/util.c
+++ b/src/util.c
@@ -550,6 +550,8 @@ int read_one_line_file(const char *fn, char **line) {
goto finish;
}
+ truncate_nl(c);
+
*line = c;
r = 0;
@@ -797,7 +799,6 @@ int get_process_name(pid_t pid, char **name) {
if (r < 0)
return r;
- truncate_nl(*name);
return 0;
}
@@ -3199,8 +3200,7 @@ void status_welcome(void) {
if (r != -ENOENT)
log_warning("Failed to read /etc/system-release: %s", strerror(-r));
- } else
- truncate_nl(pretty_name);
+ }
}
if (!ansi_color && pretty_name) {
@@ -3221,8 +3221,7 @@ void status_welcome(void) {
if (r != -ENOENT)
log_warning("Failed to read /etc/SuSE-release: %s", strerror(-r));
- } else
- truncate_nl(pretty_name);
+ }
}
if (!ansi_color)
@@ -3235,8 +3234,7 @@ void status_welcome(void) {
if (r != -ENOENT)
log_warning("Failed to read /etc/gentoo-release: %s", strerror(-r));
- } else
- truncate_nl(pretty_name);
+ }
}
if (!ansi_color)
@@ -3249,8 +3247,7 @@ void status_welcome(void) {
if (r != -ENOENT)
log_warning("Failed to read /etc/altlinux-release: %s", strerror(-r));
- } else
- truncate_nl(pretty_name);
+ }
}
if (!ansi_color)
@@ -3267,7 +3264,6 @@ void status_welcome(void) {
if (r != -ENOENT)
log_warning("Failed to read /etc/debian_version: %s", strerror(-r));
} else {
- truncate_nl(version);
pretty_name = strappend("Debian ", version);
free(version);
@@ -3826,8 +3822,6 @@ const char *default_term_for_tty(const char *tty) {
* TERM */
if (streq(tty, "console"))
if (read_one_line_file("/sys/class/tty/console/active", &active) >= 0) {
- truncate_nl(active);
-
/* If multiple log outputs are configured the
* last one is what /dev/console points to */
if ((tty = strrchr(active, ' ')))