[flashrom] [PATCH] Rigorously check integrity of I/O stream data.

Stefan Tauner stefan.tauner at alumni.tuwien.ac.at
Fri Dec 25 23:10:25 CET 2015


On Fri, 25 Dec 2015 23:17:49 +0200
Urja Rannikko <urjaman at gmail.com> wrote:

> Hi,
> 
> A small nitpick here:
> +    struct stat image_stat;
> +    if (fstat(fileno(image), &image_stat) != 0) {
> +        msg_gerr("Error: getting metadata of file \"%s\" failed:
> %s\n", filename, strerror(errno));
> +        ret = 1;
> +        goto out;
> +    }
> +    // Try to fsync() only regular files if that function is
> available at all (e.g. not provided by MinGW).
> +#if defined(_POSIX_FSYNC) && (_POSIX_FSYNC != -1)
> +    if (S_ISREG(image_stat.st_mode)) {
> +        if (fsync(fileno(image))) {
> +            msg_gerr("Error: fsyncing file \"%s\" failed: %s\n",
> filename, strerror(errno));
> +            ret = 1;
> +        }
> +    }
> +#endif
> 
> Do we want to fstat if we're not using the results (on mingw), meaning
> i suggest move the ifdef above struct stat definition.
> Atleast with that moved,
> Acked-by: Urja Rannikko <urjaman at gmail.com>
> 

True! Thanks.
Committed in r1902.

-- 
Kind regards/Mit freundlichen Grüßen, Stefan Tauner




More information about the flashrom mailing list