← Commit list

0733e840b

Matt Kraai
Matt Kraai
2002-01-02
FAILED Duration: 535s

Subject

chomp should only remove the newline if it occurs at the end of the input. This was caught by the test suite (in sed/sed-aic-commands).

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

libbb/chomp.c+5 -3
@@ -25,11 +25,13 @@
#include <string.h>
#include "libbb.h"
+
void chomp(char *s)
{
- if (!(s && *s)) return;
- while (*s && (*s != '\n')) s++;
- *s = 0;
+ char *lc = last_char_is(s, '\n');
+
+ if(lc)
+ *lc = 0;
}