Re: [PATCH v2 5/7] reftable/system: provide thin wrapper for tempfile subsystem
Patrick Steinhardt <ps@pks.im> writes:
[snip]
Show 6 quoted lines
> +
> +int tmpfile_close(struct reftable_tmpfile *t)
> +{
> + struct tempfile *tempfile = t->priv;
> + int ret = close_tempfile_gently(tempfile);
> + t->fd = -1;Nit: below we do `*t = REFTABLE_TMPFILE_INIT` should we keep things
consistent and do the same here?
Show 5 quoted lines
> + if (ret < 0)
> + return REFTABLE_IO_ERROR;
> + return 0;
> +}
> +
Show 11 quoted lines
> +/*
> + * Close the temporary file and delete it. This is a no-op in case the file has
> + * already been deleted or renamed beforehand. Returns 0 on success, a reftable
> + * error code on error.
> + */
> +int tmpfile_delete(struct reftable_tmpfile *t);
> +
> +/*
> + * Rename the temporary file to the provided path. The temporary file must be
> + * active. Return 0 on success, a reftable error code on error.
> + */
Nit: would be nice to mention that the `t` is reset here.
Show 5 quoted lines
> +int tmpfile_rename(struct reftable_tmpfile *t, const char *path);
>
> #endif
> --
> 2.47.0.229.g8f8d6eee53.dirty