Smartcard related updates
[gnupg.git] / common / xreadline.c
index ab43c29..4ea10d7 100644 (file)
@@ -95,8 +95,10 @@ read_line (FILE *fp,
             {
               int save_errno = errno;
               xfree (buffer); 
-              *length_of_buffer = *max_length = 0;
-              errno = save_errno;
+              *length_of_buffer = 0;
+              if (max_length)
+                *max_length = 0;
+              gpg_err_set_errno (save_errno);
               return -1;
             }
           buffer = *addr_of_buffer;