[Pkg-gnupg-commit] [gnupg2] 212/292: gpgscm, w32: Provide schemish file handling for binary files.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Mon Nov 21 06:31:44 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch master
in repository gnupg2.

commit 413cc50345557e0a516f33b98e8aab19bbc8b4fe
Author: Justus Winter <justus at g10code.com>
Date:   Mon Nov 7 13:12:01 2016 +0100

    gpgscm,w32: Provide schemish file handling for binary files.
    
    * tests/gpgscm/lib.scm (call-with-binary-input-file): New function.
    (call-with-binary-output-file): Likewise.
    
    Signed-off-by: Justus Winter <justus at g10code.com>
---
 tests/gpgscm/lib.scm | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/tests/gpgscm/lib.scm b/tests/gpgscm/lib.scm
index 270189d..a8ae2f8 100644
--- a/tests/gpgscm/lib.scm
+++ b/tests/gpgscm/lib.scm
@@ -187,6 +187,20 @@
 	(loop acc))))))
 
 ;;
+;; Windows support.
+;;
+
+;; Like call-with-input-file but opens the file in 'binary' mode.
+(define (call-with-binary-input-file filename proc)
+  (letfd ((fd (open filename (logior O_RDONLY O_BINARY))))
+	 (proc (fdopen fd "rb"))))
+
+;; Like call-with-output-file but opens the file in 'binary' mode.
+(define (call-with-binary-output-file filename proc)
+  (letfd ((fd (open filename (logior O_WRONLY O_CREAT O_BINARY) #o600)))
+	 (proc (fdopen fd "wb"))))
+
+;;
 ;; Libc functions.
 ;;
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list