On Thu, Mar 15, 2012 at 03:26:44AM -0400, Ted Unangst wrote:

> On Mon, Mar 12, 2012, Stuart Henderson wrote:
> > On 2012/03/12 00:49, Daniel C. Sinclair wrote:
> >> What do you think of making cksum output:
> >>
> >> (SHA256) nonexistant.txt: MISSING
> >>
> >> instead of FAILED and the extra output to stderr saying "No such file
> >> or directory"?
> > 
> > I think this would be useful (in particular, for people downloading a set
> > of packages and wanting to check them against the SHA256 file).
> 
> Index: md5.c
> ===================================================================
> RCS file: /home/tedu/cvs/src/bin/md5/md5.c,v
> retrieving revision 1.53
> diff -u -p -r1.53 md5.c
> --- md5.c     5 Jul 2011 23:39:27 -0000       1.53
> +++ md5.c     15 Mar 2012 07:25:21 -0000
> @@ -655,8 +655,7 @@ digest_filelist(const char *file, struct
>               found = 1;
>  
>               if ((fp = fopen(filename, "r")) == NULL) {
> -                     warn("cannot open %s", filename);
> -                     (void)printf("(%s) %s: FAILED\n", algorithm, filename);
> +                     (void)printf("(%s) %s: MISSING\n", algorithm, filename);
>                       error = 1;
>                       continue;
>               }

I guess you want to only print missing on ENOENT, any other like
EACCES should still print FAILED.

        -Otto

Reply via email to