Replace first occurrence of pattern in file
I think you have the error codes the other way around.  It's more common to return 0 on success and 1 (or any non-zero number) on failure, especially for debugging. If you actually need to deviate from this, then comments could help with specification.

As for the goto, it is good to avoid using it whenever possible.  Based on that little snippet, it looks like you could've used a function instead, at least if other this were needed in other places.