projects
/
u
/
mdw
/
catacomb
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
catcrypt: Increase encryption buffer to 64K.
[u/mdw/catacomb]
/
passphrase.c
diff --git
a/passphrase.c
b/passphrase.c
index
0b8ddcf
..
410b7af
100644
(file)
--- a/
passphrase.c
+++ b/
passphrase.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id
: passphrase.c,v 1.6 2004/04/08 01:36:15 mdw Exp
$
+ * $Id$
*
* Reading of passphrases (Unix-specific)
*
*
* Reading of passphrases (Unix-specific)
*
@@
-50,28
+50,37
@@
static unsigned flags = 0;
/*----- Main code ---------------------------------------------------------*/
/*----- Main code ---------------------------------------------------------*/
-/* --- @p
conn@ --- *
+/* --- @p
assphrase_connect@ ---
*
*
- * Arguments: ---
+ * Arguments: @const char *sock@ = socket name to connect to, or null for
+ * default
*
* Returns: Zero if OK, nonzero if it failed
*
* Use: Attempts to connect to the passphrase pixie.
*/
*
* Returns: Zero if OK, nonzero if it failed
*
* Use: Attempts to connect to the passphrase pixie.
*/
-
static int pconn(void
)
+
int passphrase_connect(const char *sock
)
{
if (fd != -1)
{
if (fd != -1)
- return (0);
- if (flags & f_fail)
- return (-1);
- if ((fd = pixie_open(0)) < 0) {
+ close(fd);
+ if ((fd = pixie_open(sock)) < 0) {
flags |= f_fail;
return (-1);
}
flags |= f_fail;
return (-1);
}
+ flags &= ~f_fail;
return (0);
}
return (0);
}
+static int pconn(void)
+{
+ if (fd != -1)
+ return (0);
+ if (flags & f_fail)
+ return (-1);
+ return (passphrase_connect(0));
+}
+
/* --- @passphrase_read@ --- *
*
* Arguments: @const char *tag@ = pointer to passphrase tag string
/* --- @passphrase_read@ --- *
*
* Arguments: @const char *tag@ = pointer to passphrase tag string