Ticket #664: fix_sha1.patch

File fix_sha1.patch, 643 bytes (added by Christian Kellermann, 11 years ago)

patch to return #f on filename being a directory or nonexistent file

  • simple-sha1.scm

     
    4040          (string->list digest)))))
    4141
    4242(define (sha1sum fname)
     43  (and (file-exists? fname)
     44       (not (directory? fname))
    4345  (let* ((fd (file-open fname open/rdonly))
    4446         (fsize (file-size fd))
    4547         (ctxt (allocate context-size))
     
    5658    (string-concatenate
    5759     (map (lambda (c)
    5860            (string-pad (number->string (char->integer c) 16) 2 #\0))
    59           (string->list digest)))))
     61          (string->list digest))))))
    6062
    6163)