diff options
author | Sami Kerola | 2017-05-09 20:10:49 +0200 |
---|---|---|
committer | Karel Zak | 2017-05-10 10:53:28 +0200 |
commit | b6b5272b03ea9d3fa15601801d4d0f76ea4440f1 (patch) | |
tree | b512519b48faa8e64a3eaf19f28a8a490f391cff | |
parent | lib/mbsedit: fix typo in comment (diff) | |
download | kernel-qcow2-util-linux-b6b5272b03ea9d3fa15601801d4d0f76ea4440f1.tar.gz kernel-qcow2-util-linux-b6b5272b03ea9d3fa15601801d4d0f76ea4440f1.tar.xz kernel-qcow2-util-linux-b6b5272b03ea9d3fa15601801d4d0f76ea4440f1.zip |
col: avoid extra newline if no input
BSD fix missed for 22 years, and all util-linux releases so far.
Backported-from: https://github.com/dspinellis/unix-history-repo/commit/2a15260a2a3230e02f57c096fb4c5e1f797bf4f3
Addresses: https://github.com/karelzak/util-linux/issues/422
Reported-by: Pavel Raiskup <praiskup@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
-rw-r--r-- | text-utils/col.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/text-utils/col.c b/text-utils/col.c index b236b891f..bac48e7e3 100644 --- a/text-utils/col.c +++ b/text-utils/col.c @@ -391,6 +391,8 @@ int main(int argc, char **argv) /* goto the last line that had a character on it */ for (; l->l_next; l = l->l_next) this_line++; + if (max_line == 0) + return EXIT_SUCCESS; /* no lines, so just exit */ flush_lines(this_line - nflushd_lines + extra_lines + 1); /* make sure we leave things in a sane state */ |