[Buildroot] [PATCH v5 01/19] reproducible: fix DATE/TIME macros in toolchain-wrapper
Jérôme Pouiller
jezz at sysmic.org
Wed Feb 8 10:07:07 UTC 2017
Hello Peter,
On Tuesday 07 February 2017 21:41:41 Peter Korsgaard wrote:
[...]
> > +{
> > + char *source_date_epoch;
> > + long long epoch;
> > + char *endptr;
> > +
> > + source_date_epoch = getenv("SOURCE_DATE_EPOCH");
> > + if (!source_date_epoch)
> > + return (time_t) -1;
> > +
> > + errno = 0;
> > + epoch = strtoll (source_date_epoch, &endptr, 10);
>
> NIT: No space between strtoll and '('.
>
> > + if ((errno == ERANGE && (epoch == LLONG_MAX || epoch == LLONG_MIN))
> > + || (errno != 0 && epoch == 0)) {
> > + fprintf(stderr, "environment variable $SOURCE_DATE_EPOCH: "
> > + "strtoll: %s\n", strerror(errno));
> > + exit(2);
> > + }
> > + if (endptr == source_date_epoch) {
> > + fprintf(stderr, "environment variable $SOURCE_DATE_EPOCH: "
> > + "no digits were found: %s\n", endptr);
> > + exit(2);
> > + }
> > + if (*endptr != '\0') {
> > + fprintf(stderr, "environment variable $SOURCE_DATE_EPOCH: "
> > + "trailing garbage: %s\n", endptr);
> > + exit(2);
> > + }
> > + if (epoch < 0) {
> > + fprintf(stderr, "environment variable $SOURCE_DATE_EPOCH: "
> > + "value must be nonnegative: %lld \n", epoch);
> > + exit(2);
> > + }
>
> I'm not sure this detailed error handling is really needed, but OK.
In fact I copy-paste get_source_date_epoch() from gcc git. So toolchain
wrapper will produce exactly same error messages than upstream gcc
(and it include same coding style error :-) ).
--
Jérôme Pouiller, Sysmic
Embedded Linux specialist
http://www.sysmic.fr
More information about the buildroot
mailing list