Let $f:[a,b]\to\mathbb{R}$ be Lebesgue integrable.
Clearly, if $f$ is non-negative then $$ g:[a,b]\ni x\mapsto\int_a^x f(t)\,\mathrm{d}t\in\mathbb{R} $$ is non-decreasing since for $x<y$ it holds $$ g(y)-g(x) =\int_a^y f(t)\,\mathrm{d}t-\int_a^x f(t)\,\mathrm{d}t =\int_x^y f(t)\,\mathrm{d}t\ge 0\text{.} $$
How can I show that $f$ is non-negative almost everywhere if $g$ is non-decreasing?
I would suppose that $f$ is negative on a set $A\subseteq[a,b]$ of positive measure. Then there exists a compact set $B\subseteq A$ of positive measure and it holds $$ \int_B f(t)\,\mathrm{d}x<0\text{.} $$ Does $B$ contain a non-empty interval?