Let $D = C_1\cup C_2$ be any projective reducible curve with two components meeting transversally in a point $C_1\cap C_2 = \{p\}$. A regular function $f$ on $D$ is the datum of a regular functions $f_1$ on $C_1$ and $f_2$ on $C_2$ such that $f_1(p) = f_2(p)$. The restriction map
$$\mathcal{O}_{D}\rightarrow\mathcal{O}_{C_1},\: f\mapsto f_{|C_1}$$
is clearly surjective. Indeed if $g$ is a regular function on $C_1$ on the other component $C_2$ just take the constant function $f_{2} = g(p)$.
The kernel of this restriction map are just the regular functions $f$ on $D$ such that $f_1 = f_{|C_1} = 0$. Then $f_{1}(p) = 0$ and $f_{2}(p) = f_{|C_2}(p) = f_1(p) = 0$. That is the kernel of the restriction map are the regular functions on $C_2$ vanishing at $p$, i.e. sections of $\mathcal{O}_{C_2}(-p)$. Finally we get the exact sequence
$$0\mapsto\mathcal{O}_{C_2}(-p)\rightarrow\mathcal{O}_{D}\rightarrow\mathcal{O}_{C_1}\mapsto 0.$$