Download raw body.
capsicum work: add fd field to got_repository, change got_packidx
capsicum work: add fd field to got_repository, change got_packidx
capsicum work: add fd field to got_repository, change got_packidx
On Tue, Dec 15, 2020 at 11:46:26AM -0800, Yang Zhong wrote:
> It worries me as well, as I've gotten burned by this a few times already.
> It's very confusing. I've attached this patch with a possible fix: I made
> a variation of got_error_from_errno2 that takes in three parameters,
> assumes the last two are path components, and joins them together.
>
> That way, if I have a path relative to, for example, got_repository's root
> directory, I can just pass in the repo's root path as well as the relative
> one. It's convenient since the repo's fd and path are stored in the same
> place. I hope to have relative paths be relative to these root fds
> whenever possible, so I feel that this solution will work most of the
> time. What do you think?
I'm afraid we'll end up with even more got_error functions to cover
combinations of the number of path components (separeated by /) and
error message components (separated by :).
Have you considered a construct such as:
if (fd == -1) {
char abspath[PATH_MAX];
snprintf(abspath, sizeof(abspath), "%s/%s", rootpath, relpath);
err = got_error_from_errno2("openat", abspath);
goto done;
}
That's just 2 extra lines of code compared to the case where an abspath is
already available, which isn't too bad.
capsicum work: add fd field to got_repository, change got_packidx
capsicum work: add fd field to got_repository, change got_packidx
capsicum work: add fd field to got_repository, change got_packidx