diff options
-rw-r--r-- | libbb/chomp.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/libbb/chomp.c b/libbb/chomp.c index 94404a98d..e5a522f01 100644 --- a/libbb/chomp.c +++ b/libbb/chomp.c | |||
@@ -25,13 +25,11 @@ | |||
25 | #include <string.h> | 25 | #include <string.h> |
26 | #include "libbb.h" | 26 | #include "libbb.h" |
27 | 27 | ||
28 | |||
29 | void chomp(char *s) | 28 | void chomp(char *s) |
30 | { | 29 | { |
31 | char *lc = last_char_is(s, '\n'); | 30 | if (!(s && *s)) return; |
32 | 31 | while (*s && (*s != '\n')) s++; | |
33 | if(lc) | 32 | *s = 0; |
34 | *lc = 0; | ||
35 | } | 33 | } |
36 | 34 | ||
37 | 35 | ||