"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: diff.git: Fix ed script output
To:
Tom Jones <thj@freebsd.org>
Cc:
gameoftrees@openbsd.org
Date:
Tue, 6 Sep 2022 11:00:13 +0200

Download raw body.

Thread
  • Tom Jones:

    diff.git: Fix ed script output

  • On Tue, Sep 06, 2022 at 09:38:59AM +0100, Tom Jones wrote:
    > +			rc = fprintf(dest, ".\n");
    > +			if (rc != DIFF_RC_OK)
    > +				return rc;
    
    DIFF_RC_OK is not a valid return code of fprintf.
    
    > +			if (outinfo) {
    > +				ARRAYLIST_ADD(offp, outinfo->line_offsets);
    > +				if (offp == NULL)
    > +					return ENOMEM;
    > +				outoff += rc;
    > +				*offp = *outoff;
    > +			}
    > +		}
    > +		if (rc)
    > +			return rc;
    
    The check for success (rc < 0 means error) should happen earlier, before
    the new line offset is computed based on the return code (amount of bytes
    written to the file if not < 0).
    
    
  • Tom Jones:

    diff.git: Fix ed script output